Is there a way to get last and first edit timestamp for given article in one query? - wikipedia-api

What I found is how to get last revisions for an article:
http://en.wikipedia.org/w/api.php?action=query&titles=42&prop=revisions&rvlimit=1
...and the creation date, that is first revision:
http://en.wikipedia.org/w/api.php?action=query&titles=42&prop=revisions&rvdir=newer&rvlimit=1
but is there a way to combine both requests into one query ?

It is sort of hack, and not using the API, but if you for an article appen ?action=info you will get a link to the current revision and the first revision but you will have to parse it yourself. The revision numbers are last in the URLs of the links for "Date of page creation" and "Date of latest edit" respecively. Example:
https://en.wikipedia.org/wiki/42?action=info

Related

Using an API to Extract All Comments from a Reddit Post

I am using the Reddit API (Pushshift) : https://github.com/pushshift/api
Using the documentation, I understand how I can use this to extract every comment containing the word "covid" that was left in a certain time period:
https://api.pushshift.io/reddit/search/comment?q=covid&after=3h&before=2h&size=1
The output looks something like this:
{"data":[{"subreddit_id":"t5_2qh6p","author_is_blocked":false,"comment_type":null,"edited":false,"author_flair_type":"richtext","total_awards_received":0,"subreddit":"Conservative","author_flair_template_id":null,"id":"j98zf27","gilded":0,"archived":false,"collapsed_reason_code":null,"no_follow":false,"author":"VamboRoolOkay","send_replies":true,"parent_id":41917615743,"score":1,"author_fullname":"t2_7uxkru5f","all_awardings":[],"body":"I will never believe that election fraud wasn't a significant factor. Go ahead - call it a conspiracy theory. But I also maintained that Covid was lab-created. Truth is the Daughter of Time.","top_awarded_type":null,"author_flair_css_class":null,"author_patreon_flair":false,"collapsed":false,"author_flair_richtext":[{"e":"text","t":"Conservative"}],"is_submitter":false,"gildings":{},"collapsed_reason":null,"associated_award":null,"stickied":false,"author_premium":false,"can_gild":true,"link_id":"t3_116l7ct","unrepliable_reason":null,"author_flair_text_color":"dark","score_hidden":true,"permalink":"/r/Conservative/comments/116l7ct/kamala_harris_plans_on_running_with_biden_in_2024/j98zf27/","subreddit_type":"public","locked":false,"author_flair_text":"Conservative","treatment_tags":[],"created_utc":1676866031,"subreddit_name_prefixed":"r/Conservative","controversiality":0,"author_flair_background_color":"","collapsed_because_crowd_control":null,"distinguished":null,"retrieved_utc":1676866047,"updated_utc":1676866048,"body_sha1":"328df3784d15f77b98a84418c4ce720822227cfe","utc_datetime_str":"2023-02-20 04:07:11"}],"error":null,"metadata":{"es":{"took":98,"timed_out":false,"_shards":{"total":828,"successful":828,"skipped":824,"failed":0},"hits":{"total":{"value":573,"relation":"eq"},"max_score":null}},"es_query":{"size":1,"query":{"bool":{"must":[{"bool":{"must":[{"simple_query_string":{"fields":["body"],"query":"covid","default_operator":"and"}},{"range":{"created_utc":{"gte":1676862433000}}},{"range":{"created_utc":{"lt":1676866033000}}}]}}]}},"aggs":{},"sort":{"created_utc":"desc"}},"es_query2":"{\"size\":1,\"query\":{\"bool\":{\"must\":[{\"bool\":{\"must\":[{\"simple_query_string\":{\"fields\":[\"body\"],\"query\":\"covid\",\"default_operator\":\"and\"}},{\"range\":{\"created_utc\":{\"gte\":1676862433000}}},{\"range\":{\"created_utc\":{\"lt\":1676866033000}}}]}}]}},\"aggs\":{},\"sort\":{\"created_utc\":\"desc\"}}","api_launch_time":1673017478.254743,"api_request_start":1676873233.6143198,"api_request_end":1676873233.7406816,"api_total_time":0.12636184692382812}}
My Question: Suppose I identify a post that contains the word "covid" - now, I want to retrieve every comment on this post : Is this possible to do?
For instance, based on the output of these results, I see that :
link_id: t3_116l7ct
parent_id:41917615743
Can I somehow use this information to write an API query to retrieve all comments from this post?
I tried the following query but got an empty result: https://api.pushshift.io/reddit/comment/search/?link_id=t3_116cjib
Thanks!

BAPI or FM for searching FI documents

I am searching for a BAPI to search FI documents, based on the input criteria (document type, posting date,...). Same as it is on the FB03, but the Document List screen, not the screen with only three inputs (Document Number, Company Code, Fiscal Year).
As I don't have the document number, I need the search enabled BAPI.
I am using the BAPI_ACC_DOCUMENT_POST for posting.
Any ideas?
Need to answer my own question - I was hoping to skip these two days of investigation by getting an answer here :)
BAPI_ACC_CO_DOCUMENT_FIND is correct BAPI to use for searching the posted FI documents. What I found out is that if I want to search by posting date, I have to provide Controlling Area (but instead of an error, there is nothing returned).

YouTube API Search v3 - Start index?

I'm using the YouTube Search API to grab 5 videos per time under a specific keyword. But I've been trying and trying, but couldent find the parameter for the start index. Does anyone know how to add it, so it gets the next 5 videos etc..?
Current URL I have:
https://www.googleapis.com/youtube/v3/search?part=snippet&q=wiz+khalifa&type=video&key=AIzaSyB9UW36sMDA9rja_J0ynSYVcNY4G25
In the results of your first query, you should get back a nextPageToken field.
When you make the request for the next page, you must send this value as the pageToken.
So you need to add pageToken=XXXXX to your query, where XXXXX is the value you received in nextPageToken.
Hope this helps

Sharethis api top shared urls

I'm working on building a block on my site that contains the top 5 most shared urls on my domain via the sharethis api, I've been testing it and have gotten some unexpected results...
when I check the domain statistics api, I get the expected results:
request:
http://rest.sharethis.com/analytics/V2/getDomainStats.php?domain={my-domain}&pub_key={my-publisher-key}&access_key={my-secret-key}
response:
{"status":"SUCCESS","from_date":"20120620","to_date":"20120627","data":
{"domain_summary":[{"clicks":1092,"shares":134,"traffic":1393,"date":"06\/20","channel_stats":
[{"shares":86,"clicks":404,"traffic":412,"channel":"facebook"},
{"shares":25,"clicks":617,"traffic":898,"channel":"email"},
{"shares":12,"clicks":0,"traffic":0,"channel":"fblike"},
{"shares":7,"clicks":42,"traffic":31,"channel":"twitter"},
{"shares":3,"clicks":0,"traffic":0,"channel":"plusone"},
{"shares":1,"clicks":0,"traffic":0,"channel":"pinterest"},
{"shares":0,"clicks":17,"traffic":19,"channel":"blogger"},
{"shares":0,"clicks":12,"traffic":33,"channel":"google_bmarks"}]}.....
I've truncated those results obviously since they go back for a week...
when I try to find out what urls are the most active from my domain:
request:
http://rest.sharethis.com/analytics/V2/getTopUrlStats.php?domain={my-domain}&from_date=2012-06-27&to_date=2012-01-01&pub_key={my-publisher-key}&access_key={my-secret-key}
response:
{"status":"SUCCESS","from_date":"20120627","to_date":"20120101","last_batch_date":"20120626","data":{"top_urls_summary":[]},"today":""}
Obviously this is not what I'm looking for, I have the clicks and on the sharethis site I can go to my metrics and view the info I'm looking for with no problem, but the api is not answering with any data. I have tried changing the date range or omitting it completely (which for some reason returns an empty data set) to no avail. Has anyone else run into a similar problem?
Ok Sharethis support finally got back to me about the problem:
According to sharethis api :
To Date End date for data. Note: date must be in yyyy-mm-dd format. Default is 7 days ago.
From Date Start date for data. Note: date must be in yyyy-mm-dd format. Default is 'today'.
These are backwards, that's 1 reason why my call wasn't working, "To date" should be the more recent date when defining the date range... the "defaults" don't work so you must enter both values, and when you enter todays date as the "To Date" it may return "collection failed", so best to start with yesterday

Google Reader API not showing all results

I'm using Google reader API to get all available items for any RSS feed. I use it as follows:
http://www.google.com/reader/atom/feed/[RSS FEED LINK]?n=[NUMBER OF ITEMS TO SHOW]&r=o&ot=[UNIX TIME STAMP FOR START DATE]
As I understand, this should return all items starting with the date specified by the time stamp (start date should not be older than one month ago). It works great for some feeds, but in most feeds, it doesn't show all available items (although they are available when using Google Reader).
For Example:
http://www.google.com/reader/atom/feed/http://www.360cities.net/rss/area/Greece.rss?n=1000&r=o&ot=1306959543
this link only shows items starting with 24-07-2011 to current date although it should show items starting with 26-06-2011. If the same link (http://www.360cities.net/rss/area/Greece.rss) is read by Google Reader, it'll show much more results.
Have any solutions?
Fortunately, I found the solution to my problem after a lot of research:
A url in this form returns the most recent N items of the RSS Feed
http://www.google.com/reader/atom/feed/[RSS]?n=[N]
[N] = Number of items to be displayed (max: 1000).
[RSS] = The url for the rss feed.
To get the next N older items, another parameter called Continuation String should be used. It can be found inside gr:continuation tag in each results' page. So, To get the N older items, a url in this form should be used:
http://www.google.com/reader/atom/feed/[RSS]?n=[N]&c=[C]
[N] = Number of items to be displayed (max: 1000).
[RSS] = The url for the rss feed.
[C] = Continuation string
Example:
Let's say we are interested to get results from http://www.360cities.net/rss/area/north-america.rss
To get newest 1000 item of this rss feed, The url to be used should look like:
http://www.google.com/reader/atom/feed/http://www.360cities.net/rss/area/north-america.rss?n=1000
To get the next older 1000 items, We should first search in the first result page and find the Continuation String. In this case the Continuation String is COnu-r7znpsC (it may be different when you view this post). Then, the url to be used should look like:
http://www.google.com/reader/atom/feed/http://www.360cities.net/rss/area/north-america.rss?n=1000&c=COnu-r7znpsC
To get the next older 1000 items, repeat the same process by finding the new Continuation String, etc...
If no Continuation String was found, this means that no more items are available.
I hope this would help someone.
Thanks