python3爬虫--shell命令的使用和firefox firebug获取目标信息的xpath
scrapy version -v #该命令用于查看scrapy安装的相关组件和版本
一个工程下可创建多个爬虫
scrapy genspider rxmetal rxmetal.com
scrapy genspider rxmetal2 rxmetal2.com
scrapy genspider rxmetal3 rxmetal3.com
..........
#该命令用于查看目录下的所有爬虫文件
scrapy list
#一个超级有用的玩意儿---------xpath目录文档获取器
#scrapy shell一个通用爬虫命令,可以脱离爬虫项目而存在的命令
例如:我们可以爬取废旧金属交易网的某个页面
scrapy shell http://tj.copperhome.net/201807/26/tongjia_136193.html
在成功获取页面代码之后,我们就可以用火狐浏览器打开下载的html,并配合火狐浏览器插件firebug获取感兴趣的dom结构的xpath信息。插件截图如下
使用方法如下,在页面选中感兴趣的行,右键弹出菜单,如果插件安装成功,你可以在菜单中选择inspect in firepath
直接在shell命令行中执行
response.xpath(".//*[@id='content']/table/tbody/tr[3]/td[1]/text()").extract()
拿到金属材料的名称信息
python3爬虫--shell命令的使用和firefox firebug获取目标信息的xpath的更多相关文章
- python3爬虫-爬取58同城上所有城市的租房信息
from fake_useragent import UserAgent from lxml import etree import requests, os import time, re, dat ...
- python3爬虫-通过selenium登陆拉钩,爬取职位信息
from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from se ...
- Python3爬虫04(其他例子,如处理获取网页的内容)
#!/usr/bin/env python# -*- coding:utf-8 -*- import osimport reimport requestsfrom bs4 import Navigab ...
- Python3爬虫(2)_利用urllib.urlopen发送数据获得反馈信息
一.urlopen的url参数 Agent url不仅可以是一个字符串,例如:https://baike.baidu.com/.url也可以是一个Request对象,这就需要我们先定义一个Reques ...
- Java远程执行Shell命令
1. Jar包:ganymed-ssh2-build210.jar 2. 步骤: a) 连接: Connection conn = new Connection(ipAddr); conn.conne ...
- Python3爬虫系列:理论+实验+爬取妹子图实战
Github: https://github.com/wangy8961/python3-concurrency-pics-02 ,欢迎star 爬虫系列: (1) 理论 Python3爬虫系列01 ...
- ipython, 一个 python 的交互式 shell,比默认的python shell 好用得多,支持变量自动补全,自动缩进,支持 bash shell 命令,内置了许多很有用的功能和函数
一个 python 的交互式 shell,比默认的python shell 好用得多,支持变量自动补全,自动缩进,支持 bash shell 命令,内置了许多很有用的功能和函数. 若用的是fish s ...
- python(6)-执行shell命令
可以执行shell命令的相关模块和函数有: os.system os.spawn* os.popen* --废弃 popen2.* --废弃 commands.* ...
- Scrapy的shell命令(转)
scrapy python MrZONT 2015年08月29日发布 ...
随机推荐
- SpringBoot默认日志的使用方法及常用配置
SpringBoot默认采用slf4j+logback 的组合形式,但也提供对JUL.log4j2.Logback提供了默认配置. 我们使用IDEA的spring初始化创建一个springboot项目 ...
- Netty的那些”锁”事
Netty锁事的五个关键点: ① 在意锁的对象和范围 --> 减少粒度 ② 注意锁的对象本身大小 --> 减少空间占用 ③ 注意锁的速度 --> 提高速度 ④不同场景选择不同 ...
- 数据库连接池的sqlhelper
import pymysql import threading from DBUtils.PooledDB import PooledDB """ storage = { ...
- Open API
OAuth和SSO都可以做统一认证登录,但是OAuth的流程比SSO复杂.SSO只能做用户的认证登录,OAuth不仅能做用户的认证登录,开可以做open api开放更多的用户资源. Open API即 ...
- mysql 8.x 集群出现:Last_IO_Error: error connecting to master 'repl@xxx:3306' - retry-time: 60 retries: 1
网上的经验:网络不同,账号密码不对,密码太长,密码由 # 字符:检查MASTER_HOST,MASTER_USER,MASTER_PASSWORD(不知道 MASTER_LOG_FILE 有没有影响) ...
- java lesson20homework
package com.xt.lesson20; /** * 简易自动提款机 1. 创建用户类User(包含卡号.姓名.密码.余额等属性),用户开卡时录入的姓名和密码(自动分配一个卡号.初始金额设置为 ...
- WEBAPI 最近更新项目时 服务器总是提示:An error has occurred.
解决办法: 在webconfig中设置 <system.web><customErrors mode="Off"/></system.web> ...
- c#中异常捕获,回滚
语法: try { 有可能出现错误的代码写在这里 } catch { 出错后的处理 } 如果try中的代码没有出错,则程序正常运行try中的内容后,不会执行catch中的内容, 如果try中的代码一但 ...
- C#将字符串格式化为Json
private string ConvertStringToJson(string str) { //格式化json字符串 JsonSeria ...
- 【原创】大数据基础之ETL vs ELT or DataWarehouse vs DataLake
ETL ETL is an abbreviation of Extract, Transform and Load. In this process, an ETL tool extracts the ...