How to extract Subset values from HTML tags?

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information:CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
User avatar
rajtak
Posts: 26
Joined: Mon May 11, 2009 3:57 am
Contact:

How to extract Subset values from HTML tags?

Post by rajtak » Tue Sep 18, 2018 6:44 am

Hello,
I am using iMacros for FF v7.6.0.2.1-signed, FF19, Win7_x64

Please suggest how do I extract the Rank and Category separately and split them into separate columns? My code extracts the whole HTML tag that consists of all Ranks and categories and I later split them into columns using Excel formula. I just wanted to know whether this can be split using iMacro beforehand so that I can save time creating excel formulas?

Example 1

Image

Example 2

Image

Code: Select all

'Example 1

URL GOTO=https://www.amazon.com/dp/B001BSGVFI?th=1&psc=1

'Best Seller Rank
TAG POS=1 TYPE=TR ATTR=TXT:Best<SP>Sellers<SP>Rank* EXTRACT=HTM

'Example 2

URL GOTO=https://www.amazon.com/dp/B00PUWQR3W?th=1&psc=1

'Best Seller Rank
TAG POS=1 TYPE=LI ATTR=ID:SalesRank EXTRACT=HTM

SAVEAS TYPE=EXTRACT FOLDER=* FILE=TEST4_DwL.csv
Output of CSV opened in a Excel

Image

Thank you for your help in advance.
Last edited by rajtak on Wed Sep 19, 2018 3:41 am, edited 1 time in total.
Thanks,
Raj
chivracq
Posts: 8525
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to extract Subset values from HTML tags?

Post by chivracq » Tue Sep 18, 2018 12:58 pm

rajtak wrote:Hello Chivracq,
I am using iMacros for FF v7.6.0.2.1-signed, FF19, Win7_x64

Please suggest how do I extract the Rank and Category separately and split them into separate columns? My code extracts the whole HTML tag that consists of all Ranks and categories and I later split them into columns using Excel formula. I just wanted to know whether this can be split using iMacro beforehand so that I can save time creating excel formulas?

Example 1

Image

Example 2

Image

Code: Select all

'Example 1

URL GOTO=https://www.amazon.com/dp/B001BSGVFI?th=1&psc=1

'Best Seller Rank
TAG POS=1 TYPE=TR ATTR=TXT:Best<SP>Sellers<SP>Rank* EXTRACT=HTM

'Example 2

URL GOTO=https://www.amazon.com/dp/B00PUWQR3W?th=1&psc=1

'Best Seller Rank
TAG POS=1 TYPE=LI ATTR=ID:SalesRank EXTRACT=HTM

SAVEAS TYPE=EXTRACT FOLDER=* FILE=TEST4_DwL.csv
Output of CSV opened in a Excel

Image

Thank you for your help in advance.
Yeah, you don't need to "call my Name" when opening a new Thread..., I'm not the only "Advanced" User on the Forum, and I answer Threads when I "feel like it", => if I have the Time and I know the Answer... (and if the "Content" falls into my "Ethical Standards"... (I don't help for Spam/Social Media/Games/Votes/etc... for example...))

But hum..., are you sure/"serious" about your FCI...!? :shock:
v7.6.0 for FF (+FF19...!!?) must be about 8 years old I think, the 'EVENT' Mode wasn't even implemented yet, and I'm not even sure the 'EVAL()' Command (that will be needed for the Functionality that you want) was already implemented in that Version... :shock:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
User avatar
rajtak
Posts: 26
Joined: Mon May 11, 2009 3:57 am
Contact:

Re: How to extract Subset values from HTML tags?

Post by rajtak » Wed Sep 19, 2018 3:45 am

Hello,
Thank you for your reply. Yes, 'v7.6.0 for FF' supports EVAL not sure about EVENT but I can switch to the later version, if you have any suggestions.
Thanks,
Raj
User avatar
rajtak
Posts: 26
Joined: Mon May 11, 2009 3:57 am
Contact:

Re: How to extract Subset values from HTML tags?

Post by rajtak » Wed Sep 19, 2018 4:52 am

Hello,
I can achieve this using XPATH. Thank you for your help.
Thanks,
Raj
chivracq
Posts: 8525
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to extract Subset values from HTML tags?

Post by chivracq » Wed Sep 19, 2018 8:55 am

rajtak wrote:Hello,
Thank you for your reply. Yes, 'v7.6.0 for FF' supports EVAL not sure about EVENT but I can switch to the later version, if you have any suggestions.
Hum, I was asking you to confirm your FCI, not to read from the Wiki that some 'Command' is supported from/in some Version..., hum, since v7.40 for 'EVAL()' indeed... Hum, OK..., and "only" 6 years old, from 2012...
Hum, I've been using iMacros for about 10 years now I think..., and I started with v6.50 (for FF), (I know because I still have some old Macros that I made the first day I discovered iMacros that I still use every year for some stupid Game during the Halloween Period..., rhooo, coming soon again then, ah-ah...!, and that work perfectly... But hum, 4 years thus between v6.50 and v7.60, hum..., OK...
Yeah 'EVENT' Mode, I know, from v8.24, started to be a bit stable/reliable from v8.40, time I joined the Forum I guess, as my Reason to join the Forum and my first Post was about some Bug in the 'EVENT' Mode... Still not solved btw... (but I found a Workaround since... 8) )

Beh "any suggestion", tja...!, yeah...! v8.9.7 on FF55 for example...!
rajtak wrote:Hello,
I can achieve this using XPATH. Thank you for your help.
Hum, OK, with 'XPATH', woaw!, I'm impressed, that sounds "complex" to me :oops: ("again" (related to your previous Thread about A+B and 'SET' and 'ADD')), could be useful if you shared your Solution with a Script maybe... :idea:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
Post Reply