I have some code for get pages in english
I dont know how get this in spanish
In trying to change link to es
But not appear ei continue
What could I do
lynx -dump>wikinames
I have some code for get pages in English
Idon't know how get this in Spanish
in trying to change link to es
but not appear ei limit
what could I do
this is my English code
lynx -dump>wikinames
This is my final code
lynx -dump>wikinames
Please help me
Related
I would like to parse the content of a wikipedia page, but I do miss something which I do not understand. Can someone help me ?
Example:
I have a wikipedia page:
https://it.wikipedia.org/wiki/Anni_690_a.C.
In this page a chinese politican is mentoined: "Jin Wen Gong"
I try to use the following webservice to get the content, but in the json there is no data about "Jin Wen Gong".
https://it.wikipedia.org/w/api.php?action=query&prop=revisions&rvlimit=1&titles=Anni_690_a.C.&rvprop=content&format=json
How do I parse wikipedia correctly ?
The part you are looking for is not directly in the contents of that page, which you can see if you start editing the page: you will also not see any note of jin wen gong
The part where you see it is generated from this piece of wiki-code:
{{Bio decennio a.C.|Morti|69}}
This code is in the JSON.
On Wikipedia that translates to a list of people (probably people that have died in the mentioned year, if I guess the italian?).
Not sure if this is possible, god save me from doing html regex parsing.
So I have a friend that wants a premier league (english football leauge) standings feeds on his website. I've been trying to read the wikipedia api and can't seem to find a way to convert this html element into json map. My query looks like this, very dirty, any help well appreciated.
https://en.wikipedia.org/w/api.php?format=json&action=parse&page=2015%E2%80%9316_Premier_League&format=json&prop=text§ion=6&callback=?
Here is the element Im trying to target:
https://en.wikipedia.org/wiki/2015%E2%80%9316_Premier_League#League_table
I want to build a dictionary file of Arabic to English wikipedia titles
"wiki_page_title_in_arabic" : "wiki_page_title_in_english"
I now have a list of all the wiki page titles, how can I get the corresponding titles in English ? Putting in mind the huge size of the dictionary.
You could use the API and query for the property language links (prop=langlinks) and fr ease restrict results to English (lllang=en). Example: you have the article Stockholm in Arabic: ستوكهولم
Use the query: http://ar.wikipedia.org/w/api.php?action=query&prop=langlinks&format=json&lllang=en&titles=ستوكهولم
The result will give you the English title.
I would like to create a poster showing the movies I've seen, in this fashion : http://i.stack.imgur.com/2z1js.jpg
I have a text file with the list of movies, I know how to create the poster from a bunch of images (imagemagick...), what I don't know is how to download the images.
How can I automate the task of finding the movie and downloading its poster ?
Searching for the movie and screen scraping http://www.impawards.com would also be a solution, yet a bit process-intensive and a bit shady (TOS usually forbid you to). You would then enter a query, parse the results, go to the poster page and get the URL of the displayed image
Other than that, check out the (unofficial) IMDB API, http://www.imdbapi.com/ and the SPARQL endpoint at http://www.linkedmdb.org/ . You could then try to parse the IMDB page as well.
Later edit : Found a web service as well, looks ok, don't know about comprehensiveness / reliability or which services are used to get the links : http://cpan.uwinnipeg.ca/htdocs/WebService-MoviePosterDB/WebService/MoviePosterDB.html
Hope this helps!
Construct URLs for each movie and then use wget to download the images.
hi so I need to retrieve the url for the first article on a term I search up on nytimes.com
So if I search for Apple. This link would return the result
http://query.nytimes.com/search/sitesearch?query=Apple&srchst=cse
And you just replace Apple with the term you are searching for.
If you click on that link you would see that NYtimes ask you if you mean Apple Inc.
I want to get the url for this link, and go to it.
Then you will just get a lot of information on Apple Inc.
If you scroll down you will see the articles related to Apple.
So what I ultimately want is the URL of the first article on this page.
So I really do not know how to go about this. Do I use Java, or what do I use? Any help would be greatly appreciated and I would put a bounty on this later, but I need the answer ASAP.
Thanks
EDIT: Can we do this in Java?
You can use Python with the standard urllib module to fetch the pages and the great HTML parser BeautifulSoup to obtain the information you need from the pages.
From the documentation of BeautifulSoup, here's sample code that fetches a web page and extracts some info from it:
import urllib2
from BeautifulSoup import BeautifulSoup
page = urllib2.urlopen("http://www.icc-ccs.org/prc/piracyreport.php")
soup = BeautifulSoup(page)
for incident in soup('td', width="90%"):
where, linebreak, what = incident.contents[:3]
print where.strip()
print what.strip()
print
This this is a nice and detailed article on the topic.
You certainly can do it in Java. Look at the HttpURLConnection class. Basically, you give it a URL, call the connect function, and you get back an input stream with the contents of the page, i.e. HTML text. You can then process that and parse out whatever information you want.
You're facing two challenges in the project you are describing. The first, and probably really the lesser challenge, is figuring out the mechanics of how to connect to a web page and get hold of the text within your program. The second and probably bigger challenge will be to figure out exactly how to extract the information you want from that text. I'm not clear on the details of your requirements, but you're going to have to sort through a ton of text to find what you're looking for. Without actually looking at the NY Times site at the momemnt, I'm sure it has all sorts of decorations like pretty pictures and the company logo and headlines and so on, and then there are going to be menus and advertisements and all sorts of stuff. I sincerely doubt that the NY Times or almost any other commercial web site is going to return a search page that includes nothing but a link to the article you are interested in. Somehow your program will have to figure out that the first link is to the "subscribe on line" page, the second is to an advertisement, the third is to customer service, the fourth and fifth are additional advertisements, the sixth is to the home page, etc etc until you finally get to the one you're actually interested in. How will you identify the interesting link? There are probably headings or formatting that make it recognizable to a human being, but you use a lot of intuition to screen out the clutter that can be difficult to reproduce in a program.
Good luck!
You can do this in C# using the HTML Agility Pack, or using LINQ to XML if the site is valid XHTML. EDIT: It isn't valid XHTML; I checked.
The following (tested) code will get the URL of the first search result:
var doc = new HtmlWeb().Load(#"http://query.nytimes.com/search/sitesearch?query=Apple&srchst=cse");
var url = HtmlEntity.DeEntitize(doc.DocumentNode.Descendants("ul")
.First(ul => ul.Attributes["class"] != null
&& ul.Attributes["class"].Value == "results")
.Descendants("a")
.First()
.Attributes["href"].Value);
Note that if their website changes, this code might stop working.