This file contains 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 mechanize | |
from bs4 import BeautifulSoup | |
import texttable | |
med = raw_input("Enter the drugname") | |
br = mechanize.Browser() | |
br.set_handle_robots(False) | |
res = br.open("http://www.medindia.net/drug-price/") | |
br.select_form("frmdruginfo_search") |
This file contains 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 csv | |
import urllib2 | |
from bs4 import BeautifulSoup | |
def record(part): | |
soup = BeautifulSoup(urllib2.urlopen("http://www.admision.unmsm.edu.pe/admisionsabado".format(part))) | |
links = [link.text for link in soup.find('table').find_all('a')[2:]] | |
t = (len(links)) / 2 |
This file contains 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
from selenium import webdriver | |
url = 'http://www.archives.com/member/Default.aspx?_act=VitalSearchResult&LastName=Smith&Country=US&State=VA&RecordType=2&DeathYear=2004&DeathYearSpan=10&pagesize=10&pageNumber=1&pagesizeAP=10&pageNumberAP=1' | |
driver = webdriver.Firefox() | |
driver.get(url) | |
print driver.page_source |
This file contains 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 urllib2 | |
from bs4 import BeautifulSoup | |
base_url = "http://www.boostmobile.com/stores/?page={page}&zipcode={zipcode}" | |
num_pages = 10 | |
zipcodes = [30008, 30009] | |
for zipcode in zipcodes: | |
print "Zip Code: %s" % zipcode | |
for page in xrange(1, num_pages + 1): |
This file contains 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
from scrapy.http import Request | |
from scrapy.item import Item, Field | |
from scrapy.selector import Selector | |
from scrapy.spider import BaseSpider | |
from scrapy.selector import HtmlXPathSelector | |
class MyItem(Item): | |
reviewer_ranking = Field() |
This file contains 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
from bs4 import BeautifulSoup | |
import re | |
data = """ | |
<div> | |
<p>D: string-1.string2 15030 9h7a2m string3.string<br/> | |
D: string-1.string2 15030 9h7a2m string3.string<br/> | |
D: string-1.string2 15030 9h7a2m string3.string</p> | |
<p><span id="more-1203"></span></p> |
This file contains 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 xml.etree.ElementTree as ET | |
from bs4 import BeautifulSoup | |
data = """ | |
<table> | |
<tr align="right"><td>193</td><td>Dalton</td><td>Daisy</td></tr> | |
<tr align="right"><td>194</td><td>Dakota</td><td>Amelia</td></tr> | |
<tr align="right"><td>195</td><td>Julio</td><td>Mayra</td></tr> | |
<tr align="right"><td>196</td><td>Arthur</td><td>Theresa</td></tr> | |
<tr align="right"><td>197</td><td>Pedro</td><td>Madeline</td></tr> |
This file contains 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
# -*- coding: utf-8 -*- | |
import mechanize | |
import cookielib | |
b = mechanize.Browser() | |
b.set_handle_refresh(True) | |
b.set_debug_redirects(True) | |
b.set_handle_redirect(True) | |
b.set_debug_http(True) | |
cj = cookielib.CookieJar() |
This file contains 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 | |
urls = ["https://www304.americanexpress.com/credit-card/compare"] | |
for url in urls: | |
website = requests.get(url) | |
soup = BeautifulSoup(website.content) | |
print(''.join([element.text for element in soup.body.find_all(lambda tag: tag != 'script', recursive=False)])) |
This file contains 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
from selenium import webdriver | |
import time | |
from selenium.webdriver.common.keys import Keys | |
import selenium.webdriver.support.ui as ui | |
from selenium.webdriver.support.select import Select | |
url = "http://calstate-la.bncollege.com/webapp/wcs/stores/servlet/TBWizardView?catalogId=10001&langId=-1&storeId=30556" | |
driver = webdriver.Firefox() |
OlderNewer