Skip to content

Commit 9b343fe

Browse files
committed
curl button will not update other args except url if input pure URL
1 parent 4998813 commit 9b343fe

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

test_parsers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,14 +1256,14 @@ def test_sync_crawler():
12561256
# JSON will be saved if file_path!=None
12571257

12581258
result = crawler.crawl('https://www.python.org/dev/peps/')
1259-
print(result)
1259+
# print(result)
12601260
assert result == expected_result
12611261

12621262
def test_async_crawler():
12631263

12641264
async def _test():
12651265
result = await crawler.acrawl('https://www.python.org/dev/peps/')
1266-
print(result)
1266+
# print(result)
12671267
assert result == expected_result
12681268

12691269
asyncio.get_event_loop().run_until_complete(_test())

uniparser/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
'get_available_async_request', 'get_available_sync_request', 'LazyImporter',
1919
'TorequestsAiohttpAsyncAdapter', 'SyncRequestAdapter'
2020
]
21-
__version__ = '1.8.5'
21+
__version__ = '1.8.6'

uniparser/static/uniparser.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,16 +229,14 @@ var Main = {
229229
send_child(rule, receiver_index) {
230230
this.send_child_rule_visible = false
231231
let child_rules = JSON.parse(rule.child_rules || "[]")
232-
let sender_rule = this.crawler_rule.parse_rules[
233-
this.parse_rule_idx_to_send
234-
]
232+
let sender_rule =
233+
this.crawler_rule.parse_rules[this.parse_rule_idx_to_send]
235234
sender_rule.child_rules = JSON.parse(
236235
sender_rule.child_rules || "[]"
237236
)
238237
child_rules.push(sender_rule)
239-
this.crawler_rule.parse_rules[
240-
receiver_index
241-
].child_rules = JSON.stringify(child_rules)
238+
this.crawler_rule.parse_rules[receiver_index].child_rules =
239+
JSON.stringify(child_rules)
242240
this.crawler_rule.parse_rules.splice(
243241
this.parse_rule_idx_to_send,
244242
1
@@ -415,6 +413,16 @@ var Main = {
415413
"cURL string should start with curl, or url should start with http",
416414
})
417415
.then(({ value }) => {
416+
let _old_args = JSON.parse(this.crawler_rule.request_args)
417+
if (/^https?:\/\/.*/.test(value) && _old_args.url) {
418+
_old_args.url = value
419+
this.crawler_rule.request_args = JSON.stringify(
420+
_old_args,
421+
null,
422+
2
423+
)
424+
return
425+
}
418426
this.$http.post("curl_parse", value).then(
419427
(r) => {
420428
let result = r.body

0 commit comments

Comments
 (0)