How do I get a wikipedia picture inside a app

Get help using Construct 2

Post » Tue Nov 29, 2016 1:21 pm

i know it sounds simple well its not as im not talking about copy pasting it like importing stuff... but more auto updating a picture based on different topics like lets say the presidents in the world pictures which usually are on the 2nd or 3rd row in right side in the posts searched as "Country name - President"

so im trying to make a memefull type of app.. which require this feature... basically i need a reliable source for each year.. or whenever the president is changed so i dont have to upload any files or change nothing to the app itself.. but get the link from wikipedia posts... see my point?

even though wold be much easier to just host the images myself... and update it via ajax calls... but i want to avoid that. since im probably going to never revisit this app ever again after i publish it.


the only problem is ... the images on wikipedia are having a link similar to this

Code: Select all
https://en.wikipedia.org/wiki/President_of_Romania#/media/File:Klaus_Iohannis_at_EPP_Summit,_March_2015,_Brussels_(cropped).jpg
https://en.wikipedia.org/wiki/President_of_the_United_States#/media/File:President_Barack_Obama.jpg

etc etc

see the issue? there is no pattern to follow. like president picture link folder: presidentsnapshot.jpg which should be general for all but in countries different name media folder.. big issue.


i was thinking to find the .jpg file then search for a key word in its name like president... but as you can see above... for romania there is no president mentioned in the .jpg name... so its a frustrating issue and i think i answered myself when i mentioned the ajax... but if you have any ideas let me know are more then welcome.



Edited... i did found a html5 code for the area div box that are globally used for the president pic... and i could just load the file that way based on their div container
Code: Select all
<td colspan="2" <---- this repeats on all pages... but have no idea to smoothen the search for that trough C2---------im not even sure if that is even possible in C2..like find the page div with colspan=2 then inside that div load the .jpg that is present there without knowing the name of the jpg, but only the extension format .... challenging right? in websites i wold crawl that thing simple fetching data but C2 is a bit weird when it comes to that... the double brackets thing makes it 1000 times harder for code to implement....
B
70
S
20
G
67
Posts: 1,316
Reputation: 42,305

Return to How do I....?

Who is online

Users browsing this forum: NN81, TsubaRu and 9 guests