getsy icon indicating copy to clipboard operation
getsy copied to clipboard

Not Working as expected

Open towfiqi opened this issue 7 years ago • 3 comments
trafficstars

Hi,

Thanks for the effort of building such script :)

I am trying to get some html from youtube url. like this: myGetsy.getMe("#player-api").html()

But its not fetching me anything.

But when I try with contents, I get jquery objects, and not the html:

myGetsy.getMe("#player-api").contents()

My goal is to get the innerHTML of the #player element of any youtube page.

You can test the code here: https://codepen.io/towfiqi/pen/wyQZWo

Many Thanks

towfiqi avatar Feb 27 '18 16:02 towfiqi

Try:

myGetsy.getMe("#player-api")[0]

But, it looks like that DOM element has no children, so you'll get an empty string.

epiqueras avatar Feb 27 '18 18:02 epiqueras

Thanks. Its wired that the jquery objects has the innerHTML content but not when used this method: myGetsy.getMe("#player-api")[0] Is there any way to extract the data from the jQuery object that I got using contents() ?

towfiqi avatar Feb 28 '18 03:02 towfiqi

I'm not sure what you mean. When I visit that URL and inspect the DOM on Chrome's Dev Tools, '#player-api' is in fact an empty div.

screen shot 2018-02-27 at 9 45 17 pm

epiqueras avatar Feb 28 '18 05:02 epiqueras