mozilla

(爬虫)随机生成一个header

荒凉一梦 提交于 2019-11-27 14:16:01
#!/usr/bin/env python #-*- coding: utf-8 -*- #__Author__: yunrui #__Version__: 1.0 #__Time__: 2019/1/22/22:57 #随机生成一个user-agent的header import random def getHeaders(): # 各种PC端 user_agent_list_2 = [ # Opera "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 OPR/26.0.1656.60", "Opera/8.0 (Windows NT 5.1; U; en)", "Mozilla/5.0 (Windows NT 5.1; U; en; rv:1.8.1) Gecko/20061208 Firefox/2.0.0 Opera 9.50", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 9.50", # Firefox "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101

User-Agent大全 python

有些话、适合烂在心里 提交于 2019-11-27 14:03:27
1 # -*-coding:utf-8 -*- 2 3 import random 4 5 # 返回一个随机的请求头 headers 6 def getheaders(): 7 # 各种PC端 8 user_agent_list_2 = [ 9 # Opera 10 "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 OPR/26.0.1656.60", 11 "Opera/8.0 (Windows NT 5.1; U; en)", 12 "Mozilla/5.0 (Windows NT 5.1; U; en; rv:1.8.1) Gecko/20061208 Firefox/2.0.0 Opera 9.50", 13 "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 9.50", 14 # Firefox 15 "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0", 16 "Mozilla/5.0 (X11; U; Linux x86_64; zh

爬虫day1

心已入冬 提交于 2019-11-27 13:47:41
常用模块 requests BeautifulSoup1 汽车之家爬虫练习 import requests from bs4 import BeautifulSoup ret = requests.get(url="https://www.autohome.com.cn/news/") ret.encoding = ret.apparent_encoding # print(ret.text) soup = BeautifulSoup(ret.text,'html.parser') div = soup.find(name='div',id='auto-channel-lazyload-article') li_list = div.find_all(name='li') for li in li_list: h3 = li.find(name='h3') if not h3: continue # print(h3.text) p = li.find(name='p') # print(p.text) a = li.find(name='a') # print(a.get('href')) img = li.find('img') src = img.get('src') file_name = src.rsplit('__',1)[1] print(file_name) ret

爬取酒店信息

≯℡__Kan透↙ 提交于 2019-11-27 11:59:44
import requests from lxml import etree import re import xlwt import pyodbc import random class Hotel(): #初始化 def __init__(self): self.headers = [ "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 2.0.50727; Media Center PC 6.0)", "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 1.0.3705; .NET CLR 1.1.4322)", "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2

Play mp3 file after uploading it with html5 drag and drop upload

回眸只為那壹抹淺笑 提交于 2019-11-27 11:00:51
问题 Is it possible to first upload an mp3 file with the html5 drag and drop upload system, and then play it with webkit's audio API (http://chromium.googlecode.com/svn/trunk/samples/audio/index.html) without submitting a form (in Google Chrome)? Is it possible to do in FF with Mozilla's audio API? If so, how? Also, are there any tutorials in existance for webkit's API? I have not been able to find any. 回答1: The basic process you need to follow is Capture the files using Drag and Drop Files

JS 各种引擎介绍

僤鯓⒐⒋嵵緔 提交于 2019-11-27 10:06:06
JS 各种引擎介绍 http://www.oschina.net/project/tag/296/javascript-engine 不同浏览器有不同的 JS 引擎: WebKit , Safari 浏览器 ->SquirrelFish Extreme , Firefox à TraceMonkey 引擎 Google Chrome à V8 引擎,( C++ ) Opera -> Carakan Mozilla ->SpiderMonkey(C 语言 ) Mozilla à Rhino( Java) Mozilla ->JaegerMonkey SEE (Simple ECMAScript Engine) C语言开发的轻量级的 ECMAScript (JavaScript) 解析器和实时运行环境 (1)javascript 解析引擎 V8 (C++ ) http://www.oschina.net/p/v8 V8 是 Google 发布的开源 JavaScript 引擎,采用 C++ 编写,在 Google 的 Chrome 浏览器中被使用。V8 引擎可以独立运行,也可以用来 嵌入 到 C++ 应用程序中执行。\ (2)javascript 脚本引擎 SpiderMonkey (c 语言 ) http://www.oschina.net/p/spidermonkey

Intercept and modify DOM before page is displayed to user

流过昼夜 提交于 2019-11-27 09:30:20
I'm trying to create a Firefox addon (using addon SDK) that will modify how the page is displayed, mostly as a training/learning exercise. For some tasks (like augmenting pages with new functionality) using pageMod is perfectly fine. Page loads and I run some JS to show/hide/add elements. My problem is: can I perform modification on DOM (so: the HTML document that is returned by server) before the page even starts displaying? For example: the page returned from server is: <html> <body> <table> <tr> <td>Item 1.1</td> <td>Item 1.2</td> <td>Item 1.3</td> </tr> <tr> <td>Item 2.1</td> <td>Item 2.2<

前端每日实战:4# 视频演示如何用纯 CSS 创作一个金属光泽 3D 按钮特效

情到浓时终转凉″ 提交于 2019-11-27 08:54:29
效果预览 按下右侧的“点击预览”按钮在当前页面预览,点击链接全屏预览。 https://codepen.io/zhang-ou/full/MGeRRO 可交互视频教程 此视频是可以交互的,你可以随时暂停视频,编辑视频中的代码。 请用 chrome, safari, edge 打开观看。 https://scrimba.com/c/cdKMBTk 源代码下载 请从 github 下载。 https://github.com/comehope/front-end-daily-challenges/tree/master/004-metallic-glossy-3d-button-effects 代码解读 在 dom 中定义一个容器: <div class="box">BUTTON</div> 容器居中显示: html, body { height: 100%; display: flex; align-items: center; justify-content: center; background-color: skyblue; } 设置按钮的 2d 样式,为了便于调整按钮尺寸,使用了变量: .box { background: linear-gradient(to right, gold, darkorange); color: white; --width: 250px; -

Build a DLL to be used by Mozilla js-ctypes

自闭症网瘾萝莉.ら 提交于 2019-11-27 08:32:37
问题 In reference to my first post: Mozilla use a C DLL with js-ctypes I'm trying to build a DLL to be used from a Mozilla Firefox extension. I created a little C code and compiled it with GCC. Here is the C code : #include<stdio.h> int add(int a,int b) { return(a+b); } Here are the compilation lines: gcc -c library.c gcc -shared -o library.dll library.o -Wl The DLL is well compiled, I can open it with dllexp and can see the add() method exposed. The problem is, when I try to use it from my

What is the concept of Array.map?

泄露秘密 提交于 2019-11-27 08:21:33
I am having problems understanding the concept of Array.map . I did go to Mozilla and Tutorials Point, but they provided very limited info regarding this. This is how I am using Array.map . It is a little complex (a bit of d3.js involved; just ignore it) var mapCell = function (row) { return columns.map(function(column) { return { column : column, value : getColumnCell(row, column) } }) } //getColumnCell is a function defined in my code //columns is array defined at the top of my code I do not understand exactly what this code is doing. I know its returning a new array and stuff but this part