User talk:SnorlaxMonster: Difference between revisions

Line 29: Line 29:
:It's mostly just <code>urllib.requests</code> and regular expressions. The code just iterates through each Spirit series page (I provide it a list of them) and parses the relevant table from the edit page. I probably should be using the MediaWiki API, but given how infrequently I run the code that shouldn't make a huge difference.
:It's mostly just <code>urllib.requests</code> and regular expressions. The code just iterates through each Spirit series page (I provide it a list of them) and parses the relevant table from the edit page. I probably should be using the MediaWiki API, but given how infrequently I run the code that shouldn't make a huge difference.
:I'm happy to share my code if you're interested, although since it was primarily for my personal use it's not necessarily particularly well commented (or even easy to follow) in its current form. It also doesn't currently work, because I hadn't anticipated it would need to deal with rowspans (e.g. [[List of spirits (ARMS series)|Ninjara]], [[List of spirits (Others)|Cuphead]]), and doesn't fail particularly gracefully. I can take a look at the code over the weekend though, and try to get it working again. --[[User:SnorlaxMonster|<span style="color:#A70000">'''Snorlax'''</span>]][[User talk:SnorlaxMonster|<span style="color:#0000A7">'''Monster'''</span>]] 06:53, August 27, 2020 (EDT)
:I'm happy to share my code if you're interested, although since it was primarily for my personal use it's not necessarily particularly well commented (or even easy to follow) in its current form. It also doesn't currently work, because I hadn't anticipated it would need to deal with rowspans (e.g. [[List of spirits (ARMS series)|Ninjara]], [[List of spirits (Others)|Cuphead]]), and doesn't fail particularly gracefully. I can take a look at the code over the weekend though, and try to get it working again. --[[User:SnorlaxMonster|<span style="color:#A70000">'''Snorlax'''</span>]][[User talk:SnorlaxMonster|<span style="color:#0000A7">'''Monster'''</span>]] 06:53, August 27, 2020 (EDT)
::I hadn't thought of using the edit page, I was thinking of passing the regular page and somehow getting the markup text that way. I may take a shot at it myself now that I got a rough idea on what to do; I may ask about seeing your code later if I ran in to too many issues.
::How'd you get just the Spirit Battle section? I see that there is "section=#" in the URL but that isn't the same for each series. --[[User:CanvasK|CanvasK]] ([[User talk:CanvasK|talk]]) 07:11, August 27, 2020 (EDT)
30,328

edits