Twitter api returns truncated description - twitter

I am using https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=[username]&include_rts=true&rpp=100
To get the user's tweets, but for some reason most of the tweets' description is truncated, is there any way I can get the complete description

Sadly, the RSS feeds don't contain the full tweets.
If you replace .rss with .xml or .json, then you will get the full text.
https://api.twitter.com/1/statuses/user_timeline.json?screen_name=[username]&include_rts=true&rpp=100
You will then have to transform the JSON or XML into RSS.

Related

What encoding technique needs to be used on keywords containing special characters to fetch YouTube videos

I'm trying to fetch YouTube videos for keyword 'Color&Co' but I'm unable to get similar response through YouTube API as compared to manually searching same keyword on youtube.com.
I have tried following encoding techniques to get response from YouTube API similar to manually searching on youtube.com:
keyword = 'Color&Co'
URI.encode(keyword)
CGI.escape(keyword)
ERB::Util.url_encode(keyword)
keyword.encode('iso-8859-1').encode('utf-8')
keyword.encode('iso-8859-1').force_encoding('utf-8')
keyword.force_encoding('iso-8859-1').encode('utf-8')
I'm expecting YouTube API to return response similar to searching same keywords with special characters on youtube.com.
Since it is a GET request to the endpoint documented here https://developers.google.com/youtube/v3/docs/search/list and the search term is passed as the q query string, you only need to use standard query string encoding as for any url. Even works with emojis.
Thus: ...?q=Color%26Co

Wikipedia API request sometimes not returning results

I want to make a request to the Wikipedia API to see if a given name has a Wikipedia page.
For example, let's say I make an API request to get the page for Justin Bieber:
source = "https://en.wikipedia.org/w/api.php?action=query&titles=justin%20bieber&prop=revisions&rvprop=content&format=json"
data = open(source).read
json = JSON.parse(data)
Then I get back a JSON response with this info. But why is it not returning any result for some less well known name (even though they have wiki pages?) For example, this brent bolthouse page: https://en.wikipedia.org/wiki/Brent_Bolthouse. If I check the json, there's no indication that it's an actual page..
I basically just want to implement a simple check to see if there's a wiki page that matches the exact name.
Try capitalizing all parts of the name, e.g.:
"brent bolthouse".titleize
=> "Brent Bolthouse"
I suggest this because the titles of Wikipedia's pages on persons always have that format. While your URL with the lowercase name as the query doesn't work, the URL with the capitalized name does.
Ah, I found out MediaWiki is case sensitive for page titles.

Google reader public RSS get more than 9 items

We need to parse the data from a google reader public rss feed, the problem is that the url parameter n=numerofitemstoretrieve only works up to n=9
For example in our test url:
http://www.google.com/reader/shared/user%2F15926769355350523044%2Flabel%2FPublicas%20RSS?n=2
Retrieves 2 news items
http://www.google.com/reader/shared/user%2F15926769355350523044%2Flabel%2FPublicas%20RSS?n=20
Retrieves only 9 news items
How can we overcome this limitation? Is there another parameter for this case? Or another method?
We found that using this alternative url the n parameter works fine:
https://www.google.com/reader/api/0/stream/contents/feed/http://www.google.com/reader/public/atom/user%2F15926769355350523044%2Flabel%2FPublicas%20RSS?n=20
The only problem is the output format its different this way, so if someone finds a better solution we will grant the response to him/her
It seems the results are cropped only when the url is viewed in the browser...if you get the web contents from code it returns the correct item count...(in contrast using the alternative url the returned contents are right both ways: getting them from code as well as viewing it in the browser)
In Atom format (link in the top right in the two urls in the OP) :
http://www.google.com/reader/public/atom/user%2F15926769355350523044%2Flabel%2FPublicas%20RSS?n=20
The content with /api/ in the URL in the second post is in JSON format, slightly harder to parse than the Atom XML.
https://webapps.stackexchange.com/questions/26567/how-to-raise-google-reader-rss-feed-entry-limit

Parse list of Short URL's

I have a nice long list of shortened URLs with identifiers, like:
43242 http://t.co/12352
61431 http://t.co/16192
98718 http://t.co/95351
.
Wondering if a utility exists to feed a list of shortened links and have it return the long version?
The full url is available as an entity.
You can get this with the streaming API.
Here is an example for you : Twitter Full URL - Shortened URL

Parsing Bing News Search API Results

Hey i am trying to parse Bing News API Search results, using Regex but finding it real hard. Can any one tell how to extract - 1. Snippet, 2. URL and 3. Name from all the results(10 is the default number) that are returned in one response ?
This is the response that i am receiving from Bing for a query.(there are 5 results returned in this)
http://ideone.com/yd8yl
You don't need to use a regular expression for parsing the Bing response. The response is in JSON (JavaScript Object Notation) format, and depending on your programming environment, you may use an appropriate library to parse it. Please check http://www.json.org/ if you are not familiar with what JSON is.

Resources