获取发布的头条的url,避免点击打开新的页面
https://www.toutiao.com/
document.getElementsByClassName("ugc-mode-content")[0].getElementsByTagName("a")[0].target='_self'
淘宝广告位置
写入应用
让代码在短期内产生价值
from selenium import webdriver
import os
import time
import pymysql
from bs4 import BeautifulSoup
import requests
import threading
from selenium.webdriver.common.keys import Keys h, pt, u, p, db = 'localhost', 3306, 'root', '', 'qqzone' def mysql_fetch(sql, res_type='tuple'):
global h, pt, u, p, db
try:
conn = pymysql.connect(host=h, port=pt, user=u, passwd=p, db=db, charset='utf8mb4')
except Exception as e:
print(e)
return ()
if res_type == 'dic':
cursor = conn.cursor(pymysql.cursors.DictCursor)
else:
cursor = conn.cursor()
cursor.execute(sql)
conn.commit()
r = cursor.fetchall()
cursor.close()
conn.close()
return r def mysql_write(sql):
global h, pt, u, p, db
try:
conn = pymysql.connect(host=h, port=pt, user=u, passwd=p, db=db, charset='utf8mb4')
except Exception as e:
print(e)
return 1
cursor = conn.cursor()
cursor.execute(sql)
conn.commit()
cursor.close()
conn.close()
return 0 # D:\pyaction\toutiao_team_win img_dir = 'C:/Users/Administrator/Desktop/1/toutiao_team/dl_img/'
img_dir = 'D:/pyaction/toutiao_team_win/dl_img/' import random def spider_webimg_dl_return_local_img_path(img_dir, img_url, media_type='img',
local_default='default.DONOT_REMOVE.png'):
r = '%s%s' % (img_dir, local_default) if media_type == 'img':
try:
req = requests.get(img_url)
time.sleep(3)
if req.status_code != 200:
print('-!=200')
return r
time.sleep(30)
print(img_url)
bytes = req._content
# r = '%s%s%s%s%s' % (
# img_dir, time.strftime('%Y%m%d%H%M%S', time.localtime(time.time())), str(threading.get_ident()),
# img_url.split('!/c')[0].split('/')[-1].replace('*', '_'), '.png')
# print(r) r = '%s%s%s%s%s' % (
img_dir, time.strftime('%Y%m%d%H%M%S', time.localtime(time.time())), str(threading.get_ident()),
str(random.randrange(1000, 9999)), '.png')
print(r)
filter_l = ['&', '=', '?', '-']
for fi in filter_l:
r.replace(fi, '')
if bytes != 0:
with open(r, 'wb')as f:
f.write(bytes)
except Exception as e:
print(e)
elif media_type == 'mp4':
try:
time.sleep(30) print(img_url)
r = '%s%s%s%s%s' % (
img_dir, time.strftime('%Y%m%d%H%M%S', time.localtime(time.time())), str(threading.get_ident()),
img_url.split('.mp4?')[0].split('/')[-1].replace('*', '_'), '.mp4')
print(r)
req = requests.get(img_url)
time.sleep(3)
if req.status_code != 200:
print('-!=200')
return ''
bytes = req._content
time.sleep(210)
if bytes != 0:
with open(r, 'wb')as f:
f.write(bytes)
except Exception as e:
r = ''
print(e) return r driver = webdriver.Chrome()
myurl = 'https://weibo.com/u/1779073702'
myurl = 'https://weibo.com/u/1779073702?is_all=1'
myurl = 'https://weibo.com/login.php'
driver.get(myurl)
# 此处需要内存和cpu空余,能够支持dom解析和处理重js页面
time.sleep(10)
driver.refresh()
time.sleep(60)
# xp = '//*[@id="pl_common_top"]/div/div/div[3]/div[2]/ul/li[3]/a'
# try:
# # 此处解决了不能点击该元素报错,第三次尝试ok
# driver.find_element_by_xpath(xp).click()
# time.sleep(40)
#
# except Exception as e:
# print(e)
# os._exit(1024) js = 'document.getElementsByClassName("username")[1].childNodes[0].value="leo201008@sina.cn";' \
'document.getElementsByClassName("password")[0].childNodes[0].value="welcome";' \
'document.getElementsByClassName("form_login_register")[0].childNodes[5].childNodes[0].click();'
js = 'document.getElementById("loginname").value="leo201008@sina.cn";' \
'document.getElementsByName("password")[0].value="welcome";' \
'document.getElementsByClassName("W_btn_a btn_32px")[0].click();'
try:
driver.execute_script(js)
time.sleep(30)
except Exception as e:
print(e)
os._exit(1024) while True:
sql = 'SELECT id, words,imgurls,time_site FROM qqzoneshuoshuo WHERE lefttimes_weibo>0 AND INSTR(imgurls,".mp4")=0 AND id IN ( SELECT MAX(id) FROM qqzoneshuoshuo GROUP BY id_site) ORDER BY time_script DESC,id ASC ;'
res_content = mysql_fetch(sql, 'dic')
print(res_content)
if len(res_content) == 0:
continue for i in res_content[0:]:
# id, words,imgurls,time_site
dbid, content, img_list, time_site = i['id'], i['words'], i['imgurls'], i['time_site']
if 1 > 13:
if '天' in time_site or '月' in time_site:
continue
lh = int(time.strftime("%H", time.localtime()))
if lh - int(time_site.split(':')[0]) >= 24:
continue
if '早安' in content and lh >= 11:
continue
elif '晚安' in content and lh <= 20:
continue js = 'document.getElementsByClassName("gn_set_list")[2].childNodes[0].click();'
try:
driver.execute_script(js)
except Exception as e:
print('登录验证码', e)
try:
driver.quit()
except:
pass
break time.sleep(10)
# because another element <div> obscures it
content = content.split('展开全文')[0].split('上传')[0].split('浏览')[0].replace('"', ' ').replace("'", ' ')
content = content.replace('"', ' ').replace("'", ' ').replace('\n', ' ')
filter_l = ['密龄素材空间', '评论'] for fi in filter_l:
content = content.replace(fi, ' ') print(content)
# js = 'document.getElementsByTagName("textarea")[0].value="{}新年快乐-密龄白藜芦醇DOAEZ朵韵诗-阿静艾卡尔@ http://www.icarei.cn期待与你携手前行!!";'.format(
# content)
# js = 'document.getElementsByTagName("textarea")[0].value="{}白藜芦醇-燕窝美妆-密龄DOAEZ朵韵诗-阿静艾卡尔@ http://www.icarei.cn期待与你携手前行!!";'.format(
# content)
js = 'document.getElementsByTagName("textarea")[0].value="{}南京同仁堂密龄白藜芦醇-燕窝美妆-DOAEZ朵韵诗-阿静@ http://www.icarei.cn期待与你携手前行!!";'.format(content)
ad_url='https://item.taobao.com/item.htm?id=565875313425'
js = 'document.getElementsByTagName("textarea")[0].value="{}南京同仁堂密龄白藜芦醇-燕窝美妆-DOAEZ朵韵诗-阿静@ {}!!";'.format(content,ad_url)
print(js)
try:
# 需要键盘事件 - response
driver.find_element_by_tag_name("textarea").send_keys(Keys.SPACE)
time.sleep(2)
driver.find_element_by_tag_name("textarea").send_keys(Keys.BACK_SPACE)
driver.execute_script(js) time.sleep(2)
except Exception as e:
print(e)
continue
# 先填充文本:动态dom for iimg in range(2):
js = 'document.getElementsByClassName("ficon_image")[0].click();'
driver.execute_script(js)
time.sleep(2)
upload = driver.find_element_by_id('pic_upload').find_element_by_tag_name('input')
img_url_list = img_list.split(',')
try:
# MAX=8
for img_url in img_url_list:
if '.gif' in img_url or 'qzonestyle' in img_url:
continue
local_img_path = spider_webimg_dl_return_local_img_path(img_dir, img_url,
local_default='default.DONOT_REMOVE.png')
print(local_img_path)
time.sleep(2)
upload.send_keys(local_img_path)
except Exception as e:
print(e)
try:
js = 'document.getElementsByClassName("W_layer_close")[0].click();document.getElementsByClassName("func")[0].childNodes[3].click();'
driver.execute_script(js)
time.sleep(10)
driver.refresh()
except:
pass continue time.sleep(5)
js = 'document.getElementsByClassName("W_layer_close")[0].click();document.getElementsByClassName("func")[0].childNodes[3].click();'
# js = 'document.getElementsByTagName("textarea")[0].click();document.getElementsByClassName("func")[0].childNodes[3].click();'
# js = 'document.getElementsByClassName("func")[0].childNodes[3].click();'
driver.execute_script(js) time.sleep(10) sql = 'UPDATE qqzoneshuoshuo SET lefttimes_weibo=lefttimes_weibo-1 WHERE id={}'.format(dbid)
print(sql)
try:
mysql_write(sql)
except:
pass driver.refresh() time.sleep(random.randint(60 * 2, 60 * 5))
# 15min后刷新,循环存入数据,期间定时刷新,维持页面
for si in range(15):
try:
driver.refresh()
time.sleep(60)
time.sleep(random.randint(0, 10))
print(si)
except Exception as e:
print(145, e) from selenium import webdriver
from time import sleep
import time
from selenium.webdriver.common.keys import Keys
import os import requests
import time
import threading
import logging start_time = time.strftime('%Y%m%d_%H%M%S', time.localtime(time.time()))
os_sep = os.sep
this_file_abspath, this_file_name = os.path.dirname(os.path.abspath(__file__)), os.path.abspath(__file__).split(os_sep)[
-1]
logf = this_file_name + '.log'
try:
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s[thread:%(thread)d][process:%(process)d]',
datefmt='%a, %d %b %Y %H:%M:%S',
filename=logf,
filemode='a')
except Exception as e:
s = '%s%s%s' % ('logging.basicConfig EXCEPTION ', time.strftime('%Y%m%d_%H%M%S', time.localtime(time.time())), e)
with open(logf, 'a') as fo:
fo.write(s)
print(s)
os._exit(4002) logging.info('START') img_url = 'https://s3.pstatp.com/toutiao/static/img/logo.201f80d.png'
img_dir = 'C:/Users/Administrator/Desktop/1/toutiao_team/dl_img/'
img_dir = 'D:/pyaction/toutiao_team_win/dl_img/' def spider_webimg_dl_return_local_img_path(img_dir, img_url, local_default='default.DONOT_REMOVE.png'):
r = '%s%s' % (img_dir, local_default)
try:
time.sleep(30)
bytes = requests.get(img_url)._content
# r = '%s%s%s%s%s' % (
# img_dir, time.strftime('%Y%m%d%H%M%S', time.localtime(time.time())), str(threading.get_ident()),
# img_url.replace('/', '_xl_').replace(':', '_fxl_').replace('?', '_fxlquestion_').replace('=',
# '_fxlequal_').replace(
# '&', '_fxland_'), '.png')
# r = '%s%s%s%s%s' % (
# img_dir, time.strftime('%Y%m%d%H%M%S', time.localtime(time.time())), str(threading.get_ident()),
# img_url.split('!/c')[0].split('/')[-1].replace('*', '_'), '.png')
#
r = '%s%s%s%s%s' % (
img_dir, time.strftime('%Y%m%d%H%M%S', time.localtime(time.time())), str(threading.get_ident()),
'TOUTIAO0412', '.png')
if bytes != 0:
with open(r, 'wb')as f:
f.write(bytes)
except Exception as e:
print(e)
return r import pymysql h, pt, u, p, db = 'localhost', 3306, 'root', '', 'qqzone' def mysql_fetch(sql, res_type='tuple'):
global h, pt, u, p, db
try:
conn = pymysql.connect(host=h, port=pt, user=u, passwd=p, db=db, charset='utf8')
except Exception as e:
print(e)
return ()
if res_type == 'dic':
cursor = conn.cursor(pymysql.cursors.DictCursor)
else:
cursor = conn.cursor()
cursor.execute(sql)
conn.commit()
r = cursor.fetchall()
cursor.close()
conn.close()
return r def mysql_write(sql):
global h, pt, u, p, db
try:
conn = pymysql.connect(host=h, port=pt, user=u, passwd=p, db=db, charset='utf8')
except Exception as e:
print(e)
return 1
cursor = conn.cursor()
cursor.execute(sql)
conn.commit()
cursor.close()
conn.close()
return 0 import random while True:
# if 3 > 2:
logging.info('LOOP----')
# sql = 'SELECT username,password,toutiaoid FROM xmt_star_helper_namepwd WHERE status=1 AND category=1 AND id>3000 AND NOT (toutiaoid IS NULL OR toutiaoid="" )'
# res = mysql_fetch(sql)
# ac_l = [{'u': i[0], 'p': i[1], 'toutiao_uid': i[2]} for i in res]
ac_l = [{'u': 'leo201008@sina.cn', 'p': 'welcome'}]
for ac in ac_l:
myid, mypwd, toutiao_uid = ac['u'], ac['p'], '' sql = 'SELECT id, words,imgurls,time_site FROM qqzoneshuoshuo WHERE published_time IS NULL ORDER BY time_script DESC;'
sql = 'SELECT id, words,imgurls,time_site FROM qqzoneshuoshuo WHERE published_time IS NULL AND CONCAT(words,imgurls) NOT IN (SELECT CONCAT(a.words,a.imgurls) FROM qqzoneshuoshuo_copy1 a ) ORDER BY time_script DESC;'
sql = 'SELECT id, words,imgurls,time_site FROM qqzoneshuoshuo WHERE INSTR(imgurls,".mp4")=0 ORDER BY time_script DESC LIMIT 4;'
sql = 'SELECT id, words,imgurls,time_site FROM qqzoneshuoshuo WHERE INSTR(imgurls,".mp4")=0 AND id IN ( SELECT MAX(id) FROM qqzoneshuoshuo GROUP BY id_site) ORDER BY time_script DESC,id ASC ;'
sql = 'SELECT id, words,imgurls,time_site FROM qqzoneshuoshuo WHERE lefttimes_toutiao>0 AND INSTR(imgurls,".mp4")=0 AND id IN ( SELECT MAX(id) FROM qqzoneshuoshuo GROUP BY id_site) ORDER BY time_script DESC,id ASC ;'
sql = 'SELECT id, words,imgurls,time_site FROM qqzoneshuoshuo WHERE lefttimes_toutiao>0 AND INSTR(imgurls,".mp4")=0 AND 1 ORDER BY time_script DESC,id ASC ;' logging.info(sql)
res_content = mysql_fetch(sql, 'dic')
if len(res_content) == 0:
continue
# https://www.wukong.com/question/6498933499305656590/
fake_question_l = ['6481471694505509134', '6514816760909152519',
'6498933499305656590']
browser = webdriver.Chrome()
fake_question_url = 'https://www.wukong.com/question/123/'.replace('123', random.choice(fake_question_l))
browser.get(fake_question_url)
time.sleep(random.randrange(2, 5)) js = 'window.location.href="https://www.toutiao.com/ch/news_hot/"'
browser.execute_script(js)
time.sleep(random.randrange(2, 5))
js = 'window.location.href="https://sso.toutiao.com/login/"'
browser.execute_script(js)
time.sleep(random.randrange(2, 5))
ac_type = 'mail_qq'
ac_type = 'qq'
ac_type = 'sinawb'
if ac_type == 'sinawb':
xp_newpage = '/html/body/div/div/div[2]/div/div/div/ul/li[2]'
browser.find_element_by_xpath(xp_newpage).click()
myid, mypwd = 'leo201008@sina.cn', 'welcome'
js = '%s%s%s' % ('document.getElementById("userId").value="', myid, '"')
browser.execute_script(js)
js = '%s%s%s' % ('document.getElementById("passwd").value="', mypwd, '"')
browser.execute_script(js)
xp_newpage = '//*[@id="outer"]/div/div[2]/form/div/div[2]/div/p/a[1]'
browser.find_element_by_xpath(xp_newpage).click()
time.sleep(random.randrange(60, 90)) elif ac_type == 'qq':
xp_newpage = '/html/body/div/div/div[2]/div/div/div/ul/li[3]'
browser.find_element_by_xpath(xp_newpage).click() myid, mypwd = ac['u'], ac['p']
# 当天注册的qq
if myid == '2766907843':
myid, mypwd = '2564649479', 'wanfan123qq'
js = '%s%s%s' % ('document.getElementById("u").value="', myid, '"')
browser.execute_script(js)
js = '%s%s%s' % ('document.getElementById("p").value="', mypwd, '"')
browser.execute_script(js)
time.sleep(random.randint(10, 20))
xp_newpage = '//*[@id="go"]'
browser.find_element_by_xpath(xp_newpage).click()
time.sleep(random.randint(20, 30))
elif ac_type == 'mail_qq':
xp_newpage = '/html/body/div/div/div[2]/div/div/div/ul/li[1]'
browser.find_element_by_xpath(xp_newpage).click()
myid, mypwd = 'wanf', '123332018'
js = '%s%s%s' % ('document.getElementById("account").value="', myid, '"')
browser.execute_script(js)
js = '%s%s%s' % ('document.getElementById("password").value="', mypwd, '"')
sleep(15)
browser.execute_script(js)
sleep(23)
for i in range(3):
try:
xp_newpage = '/html/body/div/div/div[2]/div/div/div/form/input'
browser.find_element_by_xpath(xp_newpage).click()
except Exception as e:
print(e) time.sleep(random.randrange(1, 3))
js = 'window.location.href="https://www.toutiao.com/"'
time.sleep(random.randrange(1, 3))
js = 'window.location.href="https://mp.toutiao.com/profile_v3/weitoutiao"'
browser.execute_script(js)
time.sleep(random.randrange(5, 8)) sql = 'SELECT id, words,imgurls,time_site FROM qqzoneshuoshuo WHERE published_time IS NULL ORDER BY time_script DESC;'
sql = 'SELECT id, words,imgurls,time_site FROM qqzoneshuoshuo WHERE published_time IS NULL AND CONCAT(words,imgurls) NOT IN (SELECT CONCAT(a.words,a.imgurls) FROM qqzoneshuoshuo_copy1 a ) ORDER BY time_script DESC;'
sql = 'SELECT id, words,imgurls,time_site FROM qqzoneshuoshuo WHERE INSTR(imgurls,".mp4")=0 AND INSTR(imgurls,"纽约")>0 ORDER BY time_script DESC,id ASC ;'
sql = 'SELECT id, words,imgurls,time_site FROM qqzoneshuoshuo WHERE INSTR(imgurls,".mp4")=0 AND 1 ORDER BY time_script DESC,id ASC ;' logging.info(sql)
res_content = mysql_fetch(sql, 'dic')
if len(res_content) == 0:
continue for i in res_content[0:]:
dbid, content, img_list, time_site = i['id'], i['words'], i['imgurls'], i['time_site'] if 1 > 13:
if '天' in time_site or '月' in time_site:
continue
lh = int(time.strftime("%H", time.localtime()))
if lh - int(time_site.split(':')[0]) >= 24:
continue
if '早安' in content and lh >= 11:
continue
elif '晚安' in content and lh <= 20:
continue xp_newpage = '/html/body/div/div[2]/div[2]/div[1]/div/div/div/div/textarea'
xp_newpage = '//*[@id="weitoutiao"]/div/div/div[1]/div[1]/textarea'
# 需要键盘事件 反爬虫
browser.find_element_by_xpath(xp_newpage).send_keys(Keys.SPACE)
# browser.find_element_by_xpath(xp_newpage).send_keys(Keys.CONTROL, 'a')
# browser.find_element_by_xpath(xp_newpage).send_keys(Keys.CONTROL, 'x')
# browser.find_element_by_xpath(xp_newpage).send_keys(Keys.CONTROL, 'v')
# browser.find_element_by_xpath(xp_newpage).send_keys(Keys.BACK_SPACE) browser.find_element_by_xpath(xp_newpage).click()
words = content
# Message: SyntaxError: unterminated string literal
mytxt = words.replace('\n', ' ').replace('\r', ' ').replace('\\br', ' ').replace('"', '“').replace("'",
'‘')
# Message: SyntaxError: missing ; before statement
mytxt = mytxt.replace("'", '‘')
##qqzone
mytxt = mytxt.split('展开全文')[0].split('上传')[0].split('浏览')[0] # 2000 头条
filter_l = ['密龄素材空间', '评论']
for fi in filter_l:
mytxt = mytxt.replace(fi, ' ') # mytxt = '{}{}'.format(mytxt, 'DOAEZ朵韵诗密龄白藜芦醇招商 王静 艾卡尔 http://www.icarei.cn ')
ad_url = 'https://item.taobao.com/item.htm?id=565875313425' mytxt = '{}{} {}'.format(mytxt, 'DOAEZ朵韵诗燕窝美妆 南京同仁堂密龄白藜芦醇 阿静 ', ad_url)
mytxt = mytxt.replace('"', ' ').replace("'", ' ').replace('\n', ' ') mytxt = mytxt[0:2000] # 处理提交异常
browser.find_element_by_xpath(xp_newpage).send_keys(Keys.UP)
#
# try:
# js = 'var a=document.getElementsByTagName("textarea")[0];a.value="{}";'.format(mytxt)
# except Exception as jse:
# print('.getElementsByTagName("textarea")--log-', jse)
# continue
# 需要键盘事件 反爬虫
browser.find_element_by_xpath(xp_newpage).send_keys(mytxt)
time.sleep(random.randint(2, 5))
xp_newpage = '/html/body/div/div[2]/div[2]/div[1]/div/div/div/div/div[1]/div[1]/span[1]/span'
xp_newpage = '//*[@id="weitoutiao"]/div/div/div[1]/button'
xp_newpage = '//*[@id="weitoutiao"]/div/div/div[1]/div[2]/div/div[1]/div/i'
browser.find_element_by_xpath(xp_newpage).click() # upload = browser.find_element_by_id('fileElem')
# upload = browser.find_element_by_class_name('upl-board picture')
upload = browser.find_element_by_class_name('upl-btn')
xp_newpage = '//*[@id="weitoutiao"]/div/div/div[1]/div[2]/div/div[2]/div/div[2]/div/input'
upload = browser.find_element_by_xpath(xp_newpage) logs_img = ''
img_url_list = img_list.split(',')
try:
for imgid in img_url_list:
img_url = imgid
if '.gif' in img_url or 'qzonestyle' in img_url:
continue
local_img_path = spider_webimg_dl_return_local_img_path(img_dir, img_url,
local_default='default.DONOT_REMOVE.png')
print(local_img_path)
time.sleep(random.randint(2, 4))
logs_img += img_url
logs_img += local_img_path
upload.send_keys(local_img_path)
time.sleep(random.randint(3, 7))
except Exception as ee:
img_url_default = ''
img_url = img_url_default
local_img_path = spider_webimg_dl_return_local_img_path(img_dir, img_url,
local_default='default.DONOT_REMOVE.png')
sleep(2)
logs_img += img_url
logs_img += local_img_path
upload.send_keys(local_img_path)
logging.exception(ee) xp_newpage = '//*[@id="weitoutiao"]/div/div/div[1]/button' try:
browser.find_element_by_xpath(xp_newpage).click()
except Exception as e:
print(e) sql = 'UPDATE qqzoneshuoshuo SET lefttimes_toutiao=lefttimes_toutiao-1 WHERE id={}'.format(dbid)
try:
mysql_write(sql)
print(sql)
except Exception as e:
print(e) time.sleep(random.randint(120, 300))
获取发布的头条的url,避免点击打开新的页面的更多相关文章
- ASP.NET 获取来源网站的网址,获取上一网页的网址,获取来源网页的URL,获取上一网页的URL
ASP.NET 获取来源网站的网址,获取上一网页的网址,获取来源网页的URL, 获取上一网页的URL Uri Url = HttpContext.Current.Request.UrlReferrer ...
- PHP 获取当前访问的完整URL
代码如下: <?php // php 获取当前访问的完整url function GetCurUrl() { $url = 'http://'; if(isset($_SERVER['HTTPS ...
- Django自动获取项目中的全部URL
import re from collections import OrderedDict from django.conf import settings from django.utils.mod ...
- dedecms获取当前文章所在栏目URL
我们知道dedecms有一个面包屑导航的调用函数,{dede:field name='position'/},这个样式是固定的,有时要个性化一些的话需要修改很多地方,那么织梦cms有没其他方法获取当前 ...
- 正则表达式 获取字符串内提取图片URL字符串
#region 获取字符串内提取图片URL字符串 /// <summary> /// 获取字符串内提取图片URL字符串 /// </summary> /// <param ...
- 蜘蛛页面 获取一个网站的全部url 乐观代码
蜘蛛页面 from selenium import webdriver import time import random from bs4 import * import pymysql h, pt ...
- JS window对象 Location对象 location用于获取或设置窗体的URL,并且可以用于解析URL。 语法: location.[属性|方法]
Location对象 location用于获取或设置窗体的URL,并且可以用于解析URL. 语法: location.[属性|方法] location对象属性图示: location 对象属性: lo ...
- Web应用中request获取path,URI,URL
Web应用中有各种获取path或URI,URL的方法,假设网页访问地址: http://localhost:8080/tradeload/TestServlet Web应用context: /trad ...
- 获取HTML中所有图片的 URL
/// <summary> /// 获取HTML中所有图片的 URL /// </summary> /// <param name="strHtml" ...
随机推荐
- 洛谷——P3918 [国家集训队]特技飞行
P3918 [国家集训队]特技飞行 神犇航空开展了一项载客特技飞行业务.每次飞行长N个单位时间,每个单位时间可以进行一项特技动作,可选的动作有K种,每种动作有一个刺激程度Ci.如果连续进行相同的动作, ...
- 样例GeoQuiz应用开发 第1章
1. Activity是Android SDK的Activity类的一个具体实例,负责管理用户和信息屏的交互.应用的功能是通过编写一个Activity子类来实现的.简单的可能只有一个子类,复杂的应用则 ...
- LeetCode 121. Best Time to Buy and Sell Stock (stock problem)
Say you have an array for which the ith element is the price of a given stock on day i. If you were ...
- jQuery_DOM学习之------包裹元素的方法
1..wrap( ):在集合中匹配的每个元素周围包裹一个HTML结构 简单的看一段代码: <span>连接文字</span> 给span元素增加一个a包裹 $('span'). ...
- hdu 1027
#include<stdio.h> #include<algorithm> using namespace std; int a[1100]; int main() { in ...
- jsp页面根据json数据动态生成table
根据需求由于不同的表要在同一个jsp展示,点击某个表名便显示某张表内容,对于java后台传给jsp页面的json形式的数据是怎么动态生成table的呢? 找了好久,终于找到某位前辈的答案,在此表示衷心 ...
- CALayer之 customizing timing of an animation
customizing timing of an animation Timing is an important part of animations, and with Core Animatio ...
- [bzoj5314][Jsoi2018]潜入行动_树形背包dp
潜入行动 bzoj-5314 Jsoi-2018 题目大意:题目链接. 注释:略. 想法: 学长给我们除了一套考试题,三个学长一人一道这是T1. 好吧好吧,傻逼背包...... 复杂度$O(nk)$. ...
- 二级域名相同的情况下子页面调用父页面的js方法
这两天项目遇到这种需求.项目是一个平台级系统,其中嵌入了多款应用.在平台上可以使用这些应用操作业务. 现在产品提出了个需求:即在A应用中需要调用js方法来打开B应用. 处理方法是:平台js中给出个打开 ...
- MongoDB学习day02--数据库增删改查
(window系统,在cmd命令提示符中使用) 一.数据库使用 管理mongodb数据库:mongo,连接本地数据库,或mongo 127.0.0.1:27017,连接其他服务器:mongo ip: ...