Advertisement
lancernik

MobileScrapV2

Apr 27th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Sat Apr 27 10:20:22 2019
  4.  
  5. @author: Gabe
  6. """
  7.  
  8. from requests import get
  9. from requests.exceptions import RequestException
  10. from contextlib import closing
  11. from bs4 import BeautifulSoup
  12. import string
  13. import re
  14. from itertools import groupby
  15. import pandas as pd
  16. import time
  17. import matplotlib.pyplot as plt
  18. import numpy as np
  19. from scipy.stats import gaussian_kde
  20. from scipy.stats import kde
  21. import seaborn as sns
  22. from sklearn.linear_model import LinearRegression
  23. from sklearn.model_selection import train_test_split
  24. import matplotlib.pyplot as plt
  25.  
  26. import requests
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34. from bs4 import BeautifulSoup
  35. from selenium import webdriver
  36. from selenium.webdriver.chrome.options import Options
  37.  
  38.  
  39.  
  40.  
  41. dr = webdriver.Chrome(executable_path=r'C:\Users\Gabe\Desktop\Lanca\chromedriver.exe')
  42. dr.get("https://www.mobile.de/pl/samochod/opel-corsa/vhc:car,pgn:1,pgs:50,ms1:19000_10_")
  43. #dr.get("https://www.google.pl")
  44. bs = BeautifulSoup(dr.page_source,"lxml")
  45.  
  46. print(bs)
  47. dr.quit()
  48. print("test")
  49.  
  50.  
  51.  
  52. file = open('text1.txt', 'w')
  53. file.write(str(bs.encode("utf-8")))
  54. file.close()
  55.  
  56. #
  57. #with open('text.txt', 'r') as myfile:
  58. # data = myfile.read()
  59. #
  60. #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement