React
- 1 ответ
- 0 вопросов
2
Вклад в тег
https://ecom.elko.ru/Account/Login
должно быть https://ecom.elko.ru/Account/Login?ReturnUrl=%2fCatalog%2fCategory%2fSCO
import scrapy
from scrapy.contrib.spiders import CrawlSpider
from scrapy.item import Item, Field
from scrapy.contrib.loader import XPathItemLoader, ItemLoader
from scrapy.http import Request, FormRequest
class ScrapyTestItem(scrapy.Item):
title = Field()
url = Field()
class ScrapyTestSpider(CrawlSpider):
name = "catalog"
def start_requests(self):
return [
FormRequest(
"https://ecom.elko.ru/Account/Login?ReturnUrl=%2fCatalog%2fCategory%2fSCO",
formdata={"Username": "ваш_логин", "Password": "ваш_пароль"}
)]
def parse(self, response):
print(response.url)
# Парсим страницу или отправляем запрос на другие.
2016-12-18 12:32:55 [scrapy] DEBUG: Redirecting (302) to <GET https://ecom.elko.ru/Catalog/Category/SCO> from <POST https://ecom.elko.ru/Account/Login?ReturnUrl=%2fCatalog%2fCategory%2fSCO>
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("http://www.youtube.com/results?search_query=" + "guitar+lessons")
results = driver.find_elements_by_xpath('//div[@class="yt-lockup-content"]')
print(len(results))
for result in results:
video = result.find_element_by_xpath('.//h3/a')
title = video.get_attribute('title')
url = video.get_attribute('href')
print("{} ({})".format(title, url))
driver.quit()
Guitar Lessons for Beginners in 21 days #1 | How to play guitar for beginners (https://www.youtube.com/watch?v=orp7WHibnaU)
GuitarLessons.com (https://www.youtube.com/user/guitarlessonscom)
Play TEN guitar songs with two EASY chords | Beginners first guitar lesson (https://www.youtube.com/watch?v=Jg-BRpn38L8)
....more