import json, re
data = '''jQuery18108711886946074578_1659960174576({"allowRetry":false,"cachedTime":"2022-08-08 20:34:35","destCountry":"Russian Federation","destCpList":[],"errorCode":"REFRESH_NOT_MODIFIED","errorMsg":"主动刷新未变更","hasRefreshBtn":false,"mailNo":"9988000xxxxxxx","originCountry":"Russian Federation","originCpList":[],"shippingTime":0.0,"showEstimateTime":false,"showQuickEvaluate":false,"status":"OWS_WHCOUTBOUND","statusDesc":"Left warehouse","success":false,"syncQuery":false})'''
json.loads(re.match(r'.*\((\{.*\})\)', data).group(1)).get('statusDesc')
# Left warehouse
for block in soup.find_all(class_=re.compile("OrderSnippetContainerStyles"))
import io
import requests
from lxml import etree
for url in links:
info = requests.get(url)
tree = etree.parse(io.StringIO(info.text), etree.HTMLParser())
rarity = tree.xpath('.//*[@id="largeiteminfo_item_type"]')[0].text
print(rarity, url)
import ast
data = {
'Action': [...],
...
}
sorted(map(ast.literal_eval, data['Action']), key=lambda x:(x[1], x[0]), reverse=True)
# [('Terminator Genisys', '2015'),
# ('Terminator Salvation', '2009'),
# ('Terminator 3: Rise of the Machines', '2003'),
# ('Terminal Velocity', '1994'),
# ('Terminator 2: Judgment Day', '1991'),
# ('Terminator, The', '1984')]
let url = process.argv[2]
var Nightmare = require('nightmare');
var nightmare = Nightmare({show: false,webPreferences: {}})
nightmare
.goto(url)
.viewport(1600, 900)
.wait(5000)
.evaluate(function() {
return document.documentElement.innerHTML;
})
.end()
.then(res => {console.log(res)});
collected_data = [
{'pattern': ['#c', 'c#'], 'result': []},
{'pattern': ['java'], 'result': []}
]
...
for name in vacancies_names:
for data in DATA:
if any([x in name.get_text().lower() for x in data['pattern']]):
data['result'].append(text)
continue
import ast
data = '''[
[1, "Иван Иванович Иванов", "Иванов И.И."],
[2, "Макар Макарович Макаров", "Макароы М.М."]
]'''
res = ast.literal_eval(data)
# [[1, 'Иван Иванович Иванов', 'Иванов И.И.'], [2, 'Макар Макарович Макаров', 'Макароы М.М.']]
type(res)
# <class 'list'>
data = '''<fireparams>
<fire>
<param name="extra_ammo" value="120" />
<param name="ammo_type" value="bullet_ar" />
<param name="bullet_chamber" value="1" />
<param name="helper_tp" value="weapon_term" />
<param name="helper_fp" value="weapon_term" />
<param name="nearmiss_signal" value="OnNearMiss" />
</fire>
</fireparams>'''
import xml.etree.ElementTree as ET
print('|'.join([f"{x.get('name')}={x.get('value')}" for x in ET.fromstring(data)[0]]))
extra_ammo=120|ammo_type=bullet_ar|bullet_chamber=1|helper_tp=weapon_term|helper_fp=weapon_term|nearmiss_signal=OnNearMiss