create account

RE: Simple Video Downloader 3.0.9 - Extract the Links + Add WhichAV Site by amosbastian

View this thread on: hive.blogpeakd.comecency.com

Viewing a response to: @justyy/simple-video-downloader-3-0-9-extract-the-links-add-whichav-site

· @amosbastian ·
$7.70
Thanks for the contribution, @justyy! It's cool that you keep adding more support to your extension, and also include tests every time you do so!

As for the code:

* There are still some places where `const` should be used, but `let` is used instead.
* There are a lot of nested *if* statements - maybe you could try swapping them around to avoid this.
* I'm not sure if using a regular expression is the best way to find all URLs of the current page. It's possible you could do something like this instead if you need URLs from an external page

```
fetch("https://steemit.com/utopian-io/@justyy/simple-video-downloader-3-0-9-extract-the-links-add-whichav-site")
  .then(response => response.text())
  .then(text => {
    const parser = new DOMParser();
    const htmlDocument = parser.parseFromString(text, "text/html");
    const urls = new Set(Array.from(htmlDocument.links).map(link => link.href));
    console.log(urls);
});
```

but since you say you extract links from the current page you could just do

```
const urls = new Set(Array.from(document.links).map(link => link.href));
```

---

Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/guidelines), as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, [click here](https://review.utopian.io/result/3/2-3-3-2-2-1-4-).

---- 
Need help? Chat with us on [Discord](https://discord.gg/uTyJkNm).

[[utopian-moderator]](https://join.utopian.io/)
👍  , , , , , , , , , , , ,
properties (23)
authoramosbastian
permlinkre-justyy-simple-video-downloader-3-0-9-extract-the-links-add-whichav-site-20190128t113825243z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["justyy"],"links":["https://join.utopian.io/guidelines","https://review.utopian.io/result/3/2-3-3-2-2-1-4-","https://discord.gg/uTyJkNm","https://join.utopian.io/"],"app":"steemit/0.1"}
created2019-01-28 11:38:24
last_update2019-01-28 11:38:24
depth1
children1
last_payout2019-02-04 11:38:24
cashout_time1969-12-31 23:59:59
total_payout_value5.842 HBD
curator_payout_value1.862 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,549
author_reputation174,473,586,900,705
root_title"Simple Video Downloader 3.0.9 - Extract the Links + Add WhichAV Site"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id79,055,179
net_rshares15,474,638,004,171
author_curate_reward""
vote details (13)
@utopian-io ·
Thank you for your review, @amosbastian! Keep up the good work!
properties (22)
authorutopian-io
permlinkre-re-justyy-simple-video-downloader-3-0-9-extract-the-links-add-whichav-site-20190128t113825243z-20190131t080523z
categoryutopian-io
json_metadata"{"app": "beem/0.20.17"}"
created2019-01-31 08:05:24
last_update2019-01-31 08:05:24
depth2
children0
last_payout2019-02-07 08:05:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length63
author_reputation152,955,367,999,756
root_title"Simple Video Downloader 3.0.9 - Extract the Links + Add WhichAV Site"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id79,200,474
net_rshares0