mozilla

【PYTHON】利用Python爬取电影网站

风格不统一 提交于 2019-11-28 17:06:36
利用Python爬取电影网站 #!/usr/bin/env python #coding = utf-8 ''' 本爬虫是用来爬取6V电影网站上的电影资源的一个小脚本程序,爬取到的电影链接会通过网页的形式显示出来 ''' import requests import re from bs4 import BeautifulSoup as bs from queue import Queue from other import getUser_Agent import threading import sys import time headers = getUser_Agent.getUser_Agent() class Movielinks(threading.Thread): def __init__(self,que,filepath,totalcount,starttime): threading.Thread.__init__(self) self._que = que self._filepath = filepath self._totalcount = totalcount self._starttime = starttime def run(self): try: while not self._que.empty(): url = self._que.get(

PDF.js scale PDF on fixed width

白昼怎懂夜的黑 提交于 2019-11-28 16:44:30
问题 I have a fixed box where I want to display my PDF's in rendered by PDF.js. As PDF.js documentation is not really accessible (spitting through their source files), I'd like to know whether it's possible to scale a rendered PDF on a fixed width. When I set as CSS: canvas { width: 600px; } for the canvas displaying the PDF, the PDF gets stretched, and the quality gets poor. 回答1: I updated the example from the Pdf.js github http://jsbin.com/pdfjs-prevnext-v2/edit#html,live to scale properly to a

【常见浏览器的UA】

只愿长相守 提交于 2019-11-28 16:19:17
原文: http://blog.gqylpy.com/gqy/307 所谓 UA(User Agent / 用户代理),最初是指浏览器告知网站管理员,本浏览器支持的类型和框架,让网站管理员以支持的模式结构向浏览器发送页面,呈现给用户浏览。演变到今天,网站管理员为了给用户带呈现最佳的页面效果,为了使不同浏览器展现同样的网站页面,通过浏览器获取用户的系统信息,包括硬件平台、系统软件、应用软件和用户个人偏好,然后通过服务器解析后以适合用户的页面类型发送到浏览器。 Python UA库 # 安装 pip install fake-useragent # 使用 from fake_useragent import UserAgent ua = UserAgent() # 随机谷歌UA chrome = ua.Chrome # 随机IE的UA ie = ua.ie # 随机火狐UA firefox = ua.Firefox # 随机浏览器的UA firefox = ua.random # 忽略大小写的,比如:ua.ie可写成ua.IE # 如果实例化时出现报错,可尝试以几种方式实例化: # ua = UserAgent(use_cache_server=False) # ua = UserAgent(cache=False) # ua = UserAgent(verify_ssl=False)

MDN javascript docs for offline use

不羁的心 提交于 2019-11-28 15:13:32
I am trying to make MDN's Javascript Reference available for offline browsing (personal use). I am not the website's owner nor developer, and I can only access its generated output. My first thought was to inject an HTML5 appcache.manifest in the page ; Using manifestR I have generated a list of the page's assets. Then I've tried pointing to my local manifest file using the file:/// protocol, using the http:// protocol and finally using a base64 string , representing the file's contents ( data:text/cache-manifest, ). Nothing seems to work. After googling a bit, I stumbled upon their public FTP

switch camera using MediaDevices.getUserMedia() in webrtc

烂漫一生 提交于 2019-11-28 13:38:16
I am trying navigator.MediaDevices.getUserMedia() webrtc to switch the device camera during the call. This functionality is working fine on the desktop browser but on mozilla android it is not working. Here is my code that i am using . var front=false; var myConstraints = { video: { facingMode: (front? "user" : "environment")} }; navigator.mediaDevices.getUserMedia(myConstraints).then(function(stream) { } any idea about this?? jib Phone hardware typically doesn't allow opening both the front and back camera at the same time. Change your code to stop() the existing stream before getting the

python爬虫增加访问量

旧城冷巷雨未停 提交于 2019-11-28 13:15:01
原文: http://blog.gqylpy.com/gqy/485 置顶:来自一名75后老程序员的武林秘籍——必读 (博主推荐) 来,先呈上武林秘籍链接: http://blog.gqylpy.com/gqy/401/ 你好,我是一名极客!一个 75 后的老工程师! 我将花两分钟,表述清楚我让你读这段文字的目的! 如果你看过武侠小说,你可以把这个经历理解为,你失足落入一个山洞遇到了一位垂暮的老者!而这位老者打算传你一套武功秘籍! 没错,我就是这个老者! 干研发 20 多年了!我也年轻过,奋斗过!我会画原理图,会画 PCB,会模拟,会数字!玩过 PLC,玩过单片机,会用汇编,会用 C!玩过 ARM,比如 PLC,STM32,和时下正在起飞的 NXP RT1052!搞过 DSP,比如 TMS320F28335!搞过 FPGA,不管 Xilinx 还是 Altera,也不管是 Verilog 还是 VHDL,或者直接画数字电路图!我懂嵌入式系统,比如 uCOS 和 Linux!我懂开源的硬件,比如 Arduino 和树莓派!我也搞软件,学了一堆上位机的语言C#,JAVA,Python,Kotlin,Swift!会写爬虫工具,又自学写APP,不管Android 还是 IOS! 可是这一切有什么用呢?土鸡瓦狗!不值一提!干技术的永远就是最苦逼的那个人! 我相信看到这里的你,应该是个 IT

Key press event is not working in Mozilla Firefox

℡╲_俬逩灬. 提交于 2019-11-28 12:51:37
Key press event is not working in Mozilla Firefox. I have create a table row dynamically with a text boix in it and that text box has a key press event too. var el = document.createElement('input'); el.type = 'text'; el.name = 'suggest2'; el.setAttribute("id",str2); el.setAttribute("onkeypress","additemifenter(this.id)"); cell2.appendChild(el); row.appendChild(cell2); In google chrome the function additemifenter(this.id) is called. But in firefox that function is not getting executed. What is the alternate way to do this in firefox? Maybe the semicolon at the end would help el.setAttribute(

for of loop querySelectorAll

╄→尐↘猪︶ㄣ 提交于 2019-11-28 12:05:34
Mozilla states that "for of loops will loop over NodeList objects correctly". (source: https://developer.mozilla.org/en-US/docs/Web/API/NodeList ) However, this doesn't work in Chrome 43. Is this incorrect documentation or a browser bug? The copied example code used on a page with checkboxes: var list = document.querySelectorAll( 'input[type=checkbox]' ); for (var item of list) { item.checked = true; } Edit: This is shipping in Chrome 51 . Jake Archibald posted a simple fix : NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator] And for of loops. The docs are correct, but I

selenium中关于鼠标下滑window.scrollTo方法知乎爬虫数据采集实例

放肆的年华 提交于 2019-11-28 10:17:23
博主帮一个朋友做论文,要分析知乎的问答数据,数据量不多,因此简单用selenium中关于鼠标下滑window.scrollTo方法爬取了知乎的‘’抑郁症“专题相关问答 一、python开头引入的模块 import requests , json , random try : import cookielib except : import http . cookiejar as cookielib import os . path try : from PIL import Image except : pass import time , csv , xml , re from selenium import webdriver from selenium . webdriver . chrome . options import Options # 从options模块中调用Options类 from selenium . webdriver . common . keys import Keys from bs4 import BeautifulSoup chrome_options = Options ( ) # 实例化Option对象 chrome_options . add_argument ( '--headless' ) # 把Chrome浏览器设置为静默模式

RTCPeerConnection.createAnswer callback returns undefined object in mozilla for WebRTC chat

一曲冷凌霜 提交于 2019-11-28 09:29:02
问题 Following is my code to answer the incoming call: var pc = connection.pc; pc.setRemoteDescription(sdp,function() { pc.createAnswer(function(answer) { pc.setLocalDescription(answer,function() { // code for sending the answer }) }) }) The above code works fine for chrome, but when i run the same in mozilla, the answer obtained from pc.createAnswer callback is undefined . As a result of which it gives me following error: TypeError: Argument 1 of RTCPeerConnection.setLocalDescription is not an