How to extract data from Webview website element (span tag)

Hello everyone is there any way to extract data from the span tag that has same class but different value given to it.
Here is what i mean.

:arrow_up: In the above photo photo you can see that the span tags has the same class in all the row it created but got different value include inside the span tag i.e :
<span_1 class=“c-span” > Facebook </span_1>
<span_1 class=“c-span” > Twitter </span_1>
<span_1 class=“c-span” > copy link</span_1>

So, now what i want to do is to get:
1.Facebook
2.Twitter
3.copy link

In a list form like Facebook, Twitter, copy link so that i can make a table for each value and make a list in my app … can anyone help me with it . Thankyou :blush:

Website i want to extract data from:
view-source:The Hot 100 – Billboard

2 Likes

If you Just Want The Text Of Facebook Copylink twitter and Embded

The Use The Following Javascript In Webviewer

To Get Text Of 

Facebook 
document.getElementsByClassName("a-font-primary-medium-xxs")[4].innerText;

Copylink
document.getElementsByClassName("a-font-primary-medium-xxs")[3].innerText;

Twitter
document.getElementsByClassName("a-font-primary-medium-xxs")[2].innerText;

Embed
document.getElementsByClassName("a-font-primary-medium-xxs")[5].innerText;

Use Following JS To Get The Volue

If You Want The All The Text Data In List So Use This

(function() {
var TextData = new Object();
TextData.Twitter = document.getElementsByClassName("a-font-primary-medium-xxs")[2].innerText;
TextData.Copylink = document.getElementsByClassName("a-font-primary-medium-xxs")[3].innerText;
TextData.Facebook = document.getElementsByClassName("a-font-primary-medium-xxs")[4].innerText;
TextData.Embed = document.getElementsByClassName("a-font-primary-medium-xxs")[5].innerText;
return JSON.stringify(TextData);
})();

It Will Give The Result Like This In json

{

"GetTwittertext":"Twitter",

"GetCopylinktext":"Copy Link",

"GetFacebooktext":"Facebook",

"GetEmbedtext":"Embed"

}




1 Like

Got your points but it feels little bit complicated with me to do that randomly
can i use ‘for’ loops to extract data… Infact I need 200 songs name , its rank and artist name from billboard website they aren’t given any api for it i thought of this way by… but it’s become complex as i have to get innertext form same class element.

See this:

1 Like

Yaa You Can Use

Try To Use For Loops Method.

I thought You Just Wanna Text Of Facebook Twitter And All

1 Like

function clickme() {
var clist = document
.getElementsByClassName(“c-label”)

var title = new object();

for (var i = 0; i < clist.length; i++) {
title.songs = clist[i].innertext;
} document.getElementById(“q”).innerHTML = return JSON.stringify(title);
}

It’s not returning me any value in inner html nither in console… can you please tell me whats wrong :blush:

Your clist Is a string or int for loop nerds an array

1 Like

Its an array with multiple value.

you can create your own api with a list of songs. it is very easy. use the online service for creating an api for this https://wrapapi.com/

1 Like

InnerText==>innertext.

You can try textContent or innerHTML

1 Like

You Just Want The Text Right ?

If You Use that then what its returning ? For What data you are using that ?

What Data You Want From The Web

1 Like

Ya the multiple text.

I need this all red box selected values in list form so that i can use in my list view.

It this possible :blush:

insert css selectors


1 Like

Thankyou so much for this it save my time.
I also get the js but its time consuming
And slow then wrapapi.com. Well I got few questions about wrapapi can you please give some time.:blush:

And Here’s the code if anyone need js.

var GetEle = document
.getElementsByClassName(“c-label”);

var Store = “”;

function clickme() {
for (var i = 0; i < GetEle
.length; i++) {
Store += GetEle[i].innerText
}
document.getElementById(“Show”)
.innerHTML = Store;
}

watch the video tutorials WrapAPI: APIs for the whole web

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.