Does anyone have any idea how to use
wikipedia Api for getting some basic json data base on search keyword like:
the Title , some short content or summary ,page url and the most important thing is the image.
I tried to use wiki api sandbox but i can't understand how to use it and set it like i want.
https://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&list=search&format=json&srsearch=dog&srnamespace=4&srprop=snippet&srlimit=15&generator=allimages
Any idea?
It's very simple, Here is a test example:
https://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&titles=donald%20Trump&format=json
read the docs
https://en.wikipedia.org/w/api.php
https://www.mediawiki.org/wiki/API%3aProperties#revisions_.2F_rv
Related
I'm looking for help with my test app to provide a news feed that parses it's data from a website, namely VMoneyNews (I have their permission to use their data).
I aim for this to parse the article title, main article text and article image of each article in the Bitcoin News category for implementation into the listView, in this case a horizontal listViewRow.
Please don't include the header text in bold at the top of each article, or the link to similar articles.
Could someone please provide this code for me? I assume this will be using the HTML dependency but I just don't know where to start implementing this feature.
Thank you.
i created a full application that shows how to parse HTML and extract data from it you can find it here but the idea is simple :
1.import this 3 libraries for html parsing
import 'package:http/http.dart' as http;
import 'package:html/parser.dart' as parser;
import 'package:html/dom.dart' as dom;
2.get the data from the page you want
Future<List<String>> getData() async {
http.Response response = await http.get('website');
}
3.extract the data from the website
dom.Document document = parser.parse(response.body);
4. depend on your need let's say you want to get all element with the article tag
document.getElementsByTagName('article')
and then you can iterate throw all article using for-each and do the same to get the data inside the article . also consider making a model class for the article so you can mangle that easily later on
Web Scraping in dart is easy now!
Just check web_scraper package on pub.
Using this package you can scrape the website's HTML tags data into simple lists & maps.
You can find a similar example in its repository.
I think a clean solution is to do those stuff on the backend if possible , if you use nodejs as your backend , you may think of casperJs or phantomJs , to parse the html DOM and extract data and return a clean json data to the mobile app .
The title maybe a little confusing so I shall explain a lot more details here. First off, I have an URL link that uses HTTPS secured site. I already managed a successful attempt to use a WebView to connect to the site, using loadDataWithBaseURL method.
The URL link does not end with .xml, so I am stuck with this problem. What are the procedures to do in order I can use the xml data on an URL link that does not ends with .xml?
EDIT:
<MGMT>
<NET>
<HEAD>
<ClientID>99999999</ClientID>
<ServerID>WEB_01</ServerID>
<Rsp>00</Rsp>
<Auth></Auth>
</HEAD>
<STAT>
<IP>192.168.5.158</IP>
<Status>OK, Success!</Status>
</NET>
</MGMT>
I do have XML parsing knowledge. But that is if the url link returns a XML data or I have an XML file. This is NOT THE ACTUAL LINK but it is similar, I changed a few values in it.
https://192.168.0.254/?ClientID=999999&Cert=0f7a248e3b017effec2b36cf53912b0f&IP=192.168.5.128
Ok. As i come to know about your question, you have to gain some knowledge about xml parsing which convert the fetched XML data in to specific variables.
Here in below examples, the project get the Http responce from the server which is in the formate of the xml file. (Which URL not having .XML extention). And that data are stored in to specific variable.
You have to fetch various data based on the tab as per your xml structure. as like "MGMT", "NET" . . .etc etc. . .
See this: Example 1
Also see this: Exapmple 2
Hope you got the Logic to do it.
What would the best approach to :
get html codes by calling url and displaying it in some views
if i would be editing the values against title tag, it must be automatically updated in the url link?
How to do this?
Check out the JSoup cookbook.
http://jsoup.org/cookbook/
This has a lot of good information in it and should be able to answer most of your questions.
You are probably looking for something along the lines of this: http://jsoup.org/cookbook/input/parse-body-fragment
I want to get a content page from Wiki in this format (the picture below) then show it in WebView. It means the content includes text and links.
I tried this but the output seems to be messy.
http://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&titles=Albert_Einstein&format=xmlfm
I stumbled across this answer a year later and would like to note that the ?action=render parameter has been depreciated as of this post.
The recommended method is to use the Mediawiki API to parse the wikitext.
You want index.php?action=render; an example. This returns the HTML of the page content with no sidebar/header/footer HTML. You'll have to match and remove infoboxes yourself.
Reference: MediaWiki — Manual:Parameters to index.php.
You can use HTML generated by mediawiki instead of wikicode.
BTW: look at this
I have list of records in xml format from my local host "http:localhost:810/Service1.svc/leb/GetAllCustomers"
Can I call this to android and list it in Textview or Spinner or in EditTextView or in any of the controls in android?
You should parse this xml file using SAX parse or Dom Parse in android and collect date in arrays/list/map according to your requirement here i am post some link to you get more information form there and get your ASAP.
http://www.androidpeople.com/android-xml-parsing-tutorial-using-saxparser
http://www.androidpeople.com/android-xml-parsing-tutorial-%E2%80%93-using-domparser
I hope this is very helpful to you.
Some links here for you.
1) Multithreading for Performance
to help you understand, how to download a file (example shows downloading an image) via AsyncTask.
2) Working with XML in Android
to help you parse your xml. Check these out. Good luck!
Yes you can do that.
Use Intent which takes URL as an argument.
In the URL you can mention the location/URI of your source.
Then, you can parse it to a string and store it.
Later, use ArrayAdapter to populate.
I can get you code if this is what you are trying to do.