# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# ## 6. Scrape the details of trending repositories on Github.com

import pandas as pd
from bs4 import BeautifulSoup
import requests
import selenium
from selenium import webdriver
import time

driver=webdriver.Chrome("chromedriver.exe")

driver.get("https://www.billboard.com/")

search_btn1=driver.find_element_by_xpath("/html/body/div[2]/div[2]/div[2]/nav/ul/li[6]/a")
search_btn1.click()

search_btn2=driver.find_element_by_xpath("/html/body/div[2]/div[2]/div[2]/div/div[3]/div[1]/div[2]/div/div[2]/a[1]/div")
search_btn2.click()

song=[]
art=[]
week=[]
peak=[]
weeksb=[]

titles_tag=driver.find_elements_by_xpath("//span[@class='chart-element__information__song text--truncate color--primary']")
for i in titles_tag:
    song.append(i.text)
song[0:5]

titles_tag1=driver.find_elements_by_xpath("//span[@class='chart-element__information__artist text--truncate color--secondary']")
for i in titles_tag1:
    art.append(i.text)
art[0:5]

titles_tag2=driver.find_elements_by_xpath("//div[@class='chart-element__meta text--center color--secondary text--last']")
for i in titles_tag2:
    week.append(i.text)
week[0:5]

titles_tag3=driver.find_elements_by_xpath("//div[@class='chart-element__meta text--center color--secondary text--peak']")
for i in titles_tag3:
    peak.append(i.text)
peak[0:5]

titles_tag4=driver.find_elements_by_xpath("//div[@class='chart-element__meta text--center color--secondary text--week']")
for i in titles_tag4:
    weeksb.append(i.text)
weeksb[0:5]

import pandas as pd
top100songs=pd.DataFrame()
top100songs['Song_name']=song[0:99]
top100songs['Artist_name']=art[0:99]
top100songs['Last_week_rank']=week[0:99]
top100songs['Peak_rank']=peak[0:99]
top100songs['Weeks_on_board']=weeksb[0:99]

top100songs



StarcoderdataJupyterScriptsDedupFiltered