Wikidata:Requests for permissions/Bot/Alexabot
- The following discussion is closed. Please do not modify it. Subsequent comments should be made in a new section. A summary of the conclusions reached follows.
- Approved --Lymantria (talk) 07:20, 30 November 2017 (UTC)[reply]
Alexabot (talk • contribs • new items • new lexemes • SUL • Block log • User rights log • User rights • xtools) Operator: Tozibb (talk • contribs • logs)
Task/s:
- Inserts or updates Alexa rank (P1661) for web page (Q36774) using the Alexa XML API (http://data.alexa.com/data?cli=10&url=%YOUR_URL%)
- pywiki based
Code:
Currently the code is only available on my computer - once the bot gets approved for testing I will upload it to a github or something similar
Function details:
- searches en.wikipedia.org for pages with Alexa rankings
- obtains their corresponding Wikidata item (if existent)
- obtains the official website (P856) of the Wikidata item
- queries Alexa API to obtain the rank of the website
- inserts or updates property Alexa rank (P1661) accordingly
- requested and inspired by Jc86035 (talk • contribs • logs)
--Tozibb (talk) 15:39, 24 September 2017 (UTC)[reply]
- Tozibb, thanks for working on this. Will this be for English Wikipedia only or will it also get URLs from other WMF wikis? Jc86035 (talk) 15:43, 24 September 2017 (UTC)[reply]
- Jc86035 , so far only the English wikipedia is queried but I can query other wikipedias as well. What would you suggest? Maybe the ten largest wikipedias? --Tozibb (talk) 16:55, 24 September 2017 (UTC)[reply]
- @Tozibb: I think the ten largest should be fine for now (maybe expand to twenty later). Jc86035 (talk) 16:58, 24 September 2017 (UTC)[reply]
- Jc86035 , so far only the English wikipedia is queried but I can query other wikipedias as well. What would you suggest? Maybe the ten largest wikipedias? --Tozibb (talk) 16:55, 24 September 2017 (UTC)[reply]
- Please perform some (50-100) test edits and create the user page for your bot (with e.g.
{{Bot}}
). Lymantria (talk) 07:37, 26 September 2017 (UTC)[reply]- pinging Tozibb Jc86035 (talk) 03:29, 1 October 2017 (UTC)[reply]
- I created the bot account page Alexabot and ran five test edits. However I run into a permission error
pywikibot.data.api.APIError: failed-save: The save has failed. [help:See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list a t <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes.; messages:[{'parameters': [], 'html': {'*': 'T he save has failed.'}, 'name': 'wikibase-api-failed-save'}, {'parameters': ['editsemiprotected', 'edit'], 'html': {'*': '<table class="plainlinks ombox ombox-protection" role="p resentation"><tr><td class="mbox-image"><a href="/wiki/File:Create_protect.svg" class="image"><img alt="Create protect.svg" src="//upload.wikimedia.org/wikipedia/commons/thumb/9 /9b/Create_protect.svg/40px-Create_protect.svg.png" width="40" height="40" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/9/9b/Create_protect.svg/60px-Create_protect.svg .png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/9/9b/Create_protect.svg/80px-Create_protect.svg.png 2x" data-file-width="20" data-file-height="20" /></a></td><td class ="mbox-text" style="font-weight:bold; font-size:130%;">This page is currently <a href="/wiki/Wikidata:Protection_policy" class="mw-redirect" title="Wikidata:Protection policy">c reate-protected</a> and can be created only by <a href="/wiki/Wikidata:Autoconfirmed_users" title="Wikidata:Autoconfirmed users">established registered users</a>.</td></tr></tab le>\n<table width="100%">\n\n<tr>\n<th> Why is this page protected? </th>\n<th> What can I do?\n</th></tr>\n<tr>\n<td><li>Some templates are indefinitely protected because their widespread use means that a single change could disrupt the appearance of many pages.</td>\n<td><li>If you do not have an account, you may <a href="/wiki/Special:CreateAccount" title="Special:CreateAccount">create one</a>. After 50 edits and 4 days, you will be able to edit semi-protected pages. Accounts that don\'t meet these requirements may bypass them with the <a href="/wiki/Wikidata:Confirmed_users" title="Wikidata:Confirmed users">confirmed user</a> right, which may be requested at <a href="/wiki/Wikidata:Requests_for_ permissions#Requests_for_other_rights" title="Wikidata:Requests for permissions">Wikidata:Requests for permissions#Requests for other rights</a>.\n</td></tr>\n<tr>\n<td><li>Alth ough most items, properties, and pages on Wikidata are free to be edited by anyone, semi-protection is often used to stop persistent <a href="/wiki/Wikidata:Vandalism" title="Wi kidata:Vandalism">vandalism</a>.</td>\n<td>\n</td></tr>\n<tr>\n<td><li>The latest <span class="plainlinks"><a class="external text" href="//www.wikidata.org/w/index.php?title=Sp ecial:Log&type=protect&page=Special:Badtitle/dummy_title_for_API_calls_set_in_api.php">protection log</a></span> entry contains the reason left by the protecting adminis trator for this protection. If there is no relevant log entry, it may be because this page has been moved after being protected.</td>\n<td><li>You may ask for unprotection at <a href="/wiki/Wikidata:Administrators%27_noticeboard" title="Wikidata:Administrators\' noticeboard">Wikidata:Administrators\' noticeboard</a>.\n</td></tr>\n</table>\n'}, 'name': 'protectedpagetext'}, {'parameters': [], 'html': {'*': '⧼no-permission⧽'}, 'name': 'no-permission'}]]
Lymantria, do you know how what is the reason for this error and/or how to resolve it? Thanks for your input.
- Pinging Lymantria. Tozibb, this is because your bot was not yet autoconfirmed (4 days, 50 edits), although it now is. I don't know which page it was editing, but autoconfirmed is usually the highest level of protection applied on items, so it should be a non-issue now. Jc86035 (talk) 13:10, 2 October 2017 (UTC)[reply]
- If the problem was being autoconfirmed, it should be solved now. I granted the "confirmed" flag. Lymantria (talk) 13:15, 2 October 2017 (UTC)[reply]
- The problem is resolved. Thanks Lymantria --Tozibb (talk) 16:24, 8 October 2017 (UTC)[reply]
- If the problem was being autoconfirmed, it should be solved now. I granted the "confirmed" flag. Lymantria (talk) 13:15, 2 October 2017 (UTC)[reply]
- Tozibb, please go over the data you added and add the qualifier point in time (P585) 1 October 2017 and source reference URL (P854) https://www.alexa.com/siteinfo/$1. You can probably do this by downloading a property–value table for the items your bot edited, adding the qualifier/reference, and sticking it into QuickStatements (although maybe you'd prefer to do it using pywiki). Also, you should remove the duplicate values that you initially added. Jc86035 (talk) 13:22, 2 October 2017 (UTC)[reply]
I continued working on the bot which now adds point in time (P585) and reference URL (P854) along with archive URL (P1065) as sources for Alexa rank (P1661). Furthermore it is now possible to set a minimum period of days between before a new alexa rank claim is added. The latest Alexa rank (P1661) is set to "preferred" value. My test run includes Alexa rank (P1661) updates for ten items. Could you please check/verify its work? If all is fine, I would like to increase the number of items to be edited. Furthermore I would like your opinion on the timespan between two updates of Alexa rank (P1661). I don't want the to "spam" WikiData by i.e. by letting it run every 5 days or so. I think of every 2 or 4 weeks should be good to capture the alexa ranking - this seems to be a good tradeoff for me.
Thanks for your help on this. --Tozibb (talk) 15:12, 8 November 2017 (UTC)[reply]
- @Tozibb: It's working fine, except point in time (P585) should be added as a qualifier and not as part of the reference. Is the archival of the Alexa ranking page updated automatically as well? I think a time period of four weeks should work. Jc86035 (talk) 10:27, 9 November 2017 (UTC)[reply]
- @Jc86035:. Thanks for your feedback. I added point in time (P585) as qualifier (currently testing on Wikidata Sandbox (Q4115189)). I trigger the archivation of the alexa ranking page and use a timestamp(now) to create archive URL (P1065). This way archive.org returns the snapshot of the requested page closest to the specified timestamp in the URL. I will update 5 more items with the new alexa ranking soon to continue testing.
Hi Lymantria,
I did some test runs for this bot and the output looks good to me (i.e. qualifier / references get added). Therefore I would like to ask you if you can grant Alexabot the status of an offcial bot or let me know what is missing to get the bot status. Thanks for your help. --Tozibb (talk) 16:50, 28 November 2017 (UTC)[reply]
- I am ready to grant the bot flag in a couple of days, given that no objections are raised meanwhile. Lymantria (talk) 19:52, 28 November 2017 (UTC)[reply]