Skip to content

Instantly share code, notes, and snippets.

@prerakmody
Last active September 17, 2020 17:22
Show Gist options
  • Save prerakmody/b4b649afe1e40781194388ca525907c1 to your computer and use it in GitHub Desktop.
Save prerakmody/b4b649afe1e40781194388ca525907c1 to your computer and use it in GitHub Desktop.
Beautiful Soup
import requests
from bs4 import BeautifulSoup
def get_framecount(url):
sess = requests.Session()
r = sess.get(url)
soup = BeautifulSoup(r.text, "lxml")
div = soup.find_all('div', {'class' : 'raw-block'})
frames_count = []
for element in div:
frames = int(element.contents[5].split(' ')[1].replace('\n', ''))
frames_count.append(frames)
return frames_count
if __name__ == "__main__":
url = 'http://www.cvlibs.net/datasets/kitti/raw_data.php'
url = 'http://www.cvlibs.net/datasets/kitti/raw_data.php?type=residential'
url = 'http://www.cvlibs.net/datasets/kitti/raw_data.php?type=road'
url = 'http://www.cvlibs.net/datasets/kitti/raw_data.php?type=campus'
url = 'http://www.cvlibs.net/datasets/kitti/raw_data.php?type=person'
frames_count = get_framecount(url)
print (frames_count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment