It is currently March 28th, 2024, 11:29 pm

WebParser using a list of URLs from a text file, one by one

Get help with creating, editing & fixing problems with skins
User avatar
MazinLabib10
Posts: 14
Joined: January 21st, 2023, 3:47 pm

WebParser using a list of URLs from a text file, one by one

Post by MazinLabib10 »

UPDATE: I've managed to solve this issue on my own using the power of Excel to duplicate the code but while changing the number in the measure name. Then I ran the code bit-by-bit in a throwaway skin, retrieving the name for 300 clubs at a time. It's just a patience-requiring workaround that I've found but I'm sure there might be a more efficient way. Feel free to reply if you do know such a method, so that it may be helpful to somebody in the future!
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Hello fellow Rainmeter lovers!

I'm currently working on my first fully OC skin, which shows the previous and next game for any football/soccer team of your choosing. I'm grateful for the help I received from you guys last time I had an issue with this skin, and now I have another problem.

So, I have managed to get a .txt file that contains links to the "Matches" page for all 10,000(!) teams available on the website I'm using. Now what I want to do is to get the team name for each of these teams as stated on their respective pages. I feel there could be different ways of doing this, but what I was thinking of is to use WebParser to retrieve the name and then write that value into the original file. To do this, I've formatted the .txt file to resemble a .ini file and saved a copy of it as a .ini file. Here's a sample of what the list looks like now:

Code: Select all

[M1]
Name=
URL=https://www.besoccer.com/team/matches/07-vestur

[M2]
Name=
URL=https://www.besoccer.com/team/matches/07-vestur-ii

[M3]
Name=
URL=https://www.besoccer.com/team/matches/07-vestur-iii

[M4]
Name=
URL=https://www.besoccer.com/team/matches/12-bingolspor

[M5]
Name=
URL=https://www.besoccer.com/team/matches/1860-munchen

[M6]
Name=
URL=https://www.besoccer.com/team/matches/1860-munchen-ii
If I wanted to retrieve the team name for just the first link, for instance, this would be the code:

Code: Select all

[Rainmeter]
Update=1000

[Measure1]
Measure=WebParser
URL=file:///C:/Users/hp/Documents/Rainmeter/Skins/FlashFTBL/Clubs.txt
RegExp=(?siU)URL=(.*)\r
StringIndex=1
FinishAction=[!SetOption Measure1Name URL "[*&Measure1*]"][!CommandMeasure Measure1Name "Update"]

[Measure1Name]
Measure=WebParser
RegExp=(?siU)<div class="head-content fws-hide player-head text-center">.*<div class="top-row mv10">.*<div class="head-title">.*<h2 class="title ta-c">(.*)</h2>
StringIndex=1
FinishAction=[!WriteKeyValue M1 Name [Measure1Name] "C:\Users\hp\Documents\Rainmeter\Skins\FlashFTBL\Clubs.ini"]

[MeterDummy]
Meter=String
This returns "07 Vestur" as the value for Name in [M1} of Clubs.ini. The problem arises in repeating this for the 2nd link, 3rd link, and so on. If it was less than a 100 links, I may have considered doing it manually, but since there's 10,000, I need an alternate solution.

To make it clear, my end goal is just to have a list of team names with their corresponding links. It does NOT have to be a .ini file. I plan to use this in a team selection search bar later on. Hope someone can help me out with this 'cause I'm basically stuck now.