Skip to content

Instantly share code, notes, and snippets.

View iamtalhaasghar's full-sized avatar
🇵🇰
Working From Home

Talha Asghar iamtalhaasghar

🇵🇰
Working From Home
  • Pakistan
  • 12:15 (UTC +05:00)
View GitHub Profile
@iamtalhaasghar
iamtalhaasghar / email_scraper_from_google_forms_analytics_page.js
Last active December 9, 2020 11:03
A simple javascript code snippet to scrap emails from a Google Forms Page (View other Responses Page). Just open up the Google Form in a new tab. Go to Console, paste the code and boom!!! ProTip: Copy the console log to clipboard and then paste the clipboard contents to a newly created .txt file. You will have your required data in a nice format.
/*
It only scraps first 100 emails because other emails are not visible.
Whenever I will have time, i will try to work around this problem
Tested on Firefox 80.0.1
Not sure about other browsers, (theoretically it should work)
*/
// xpath of div containing emails in a google form
allDivs = $x("//*[contains(text(),'Email') and @class='freebirdAnalyticsViewQuestionTitle']/ancestor::div[@class='freebirdAnalyticsViewAnalyticsHover']")
// get innerText which is essentially emails of all correspondents and also contains some other irrelevant text
uglyData = allDivs[0].innerText.split('\n')
@iamtalhaasghar
iamtalhaasghar / youtube_videos_title_scraper_from_a_playlist.js
Last active December 9, 2020 10:51
A simple javascript code snippet to scrap video list from a youtube playlist. Just open up the playlist in a new tab. Go to Console, paste the code and boom!!! ProTip: Copy the console log to clipboard and then paste the clipboard contents to a newly created .csv file. You will have your required data in a nice clean format.
/*
I use this script to scrap video titles of a playlist of my competitor and
then I use those keywords in my playlist videos too.
Tested on Firefox 80.0.1
Not sure about other browsers
*/
// get div containing playlist items
playlist = document.getElementsByTagName('ytd-playlist-video-renderer')