Last active
September 17, 2020 17:22
-
-
Save prerakmody/b4b649afe1e40781194388ca525907c1 to your computer and use it in GitHub Desktop.
Beautiful Soup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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