Jump to content
Phishing Emails & YouTube Messages - Fake Giveaway Read more... ×
Search In
  • More options...
Find results that contain...
Find results in...

PAEz

Member
  • Content Count

    9
  • Joined

  • Last visited

Awards


This user doesn't have any awards

About PAEz

  • Title
    Newbie
  1. PAEz

    [Javascript] Can a function call itself?

    hehe, cool, thanks for the clarify
  2. PAEz

    [Javascript] Can a function call itself?

    @Erik Sieghart I get the speed thing.... https://jsperf.com/array-prototype-slice-call-vs-slice-call/12 But I dont understand why it would affect stack space and cant find anything on it. Would you have any links I could read? I have a little understanding of stack stuff but not this. Unless you meant the recursion thing, which makes sense.
  3. PAEz

    webscraping football transfers

    Cant you just target the next page link, Im assuming you targeted the individual links. Something like this.... {"_id":"tryagain","startUrl":["https://www.transfermarkt.com/transfers/transfertagedetail/statistik/top/land_id_zu/0/land_id_ab/0/leihe//datum/2019-01-31"],"selectors":[{"id":"nextpage","type":"SelectorLink","parentSelectors":["_root","nextpage"],"selector":"li.naechste-seite a","multiple":false,"delay":0},{"id":"data","type":"SelectorText","parentSelectors":["_root","nextpage"],"selector":"td.hauptlink","multiple":true,"regex":"","delay":0}]} This got all 43 pages of the target link. If you want more help feel free to post your sitemap and Ill have a look at it.
  4. PAEz

    YouTube comment scraping (read).

    fetchCommentPage raises an error if theres no comments on the page as your using await. Heres a quick fix.... https://repl.it/@PeterIrlam/Youtube-comments
  5. Your test on that test site is flawed, you should have declared the array.prototype function in the setup. Right now its doing it ever test which will slow it down alot. And pre declaring the function and not as an argument can speed things up a bit aswell. http://jsben.ch/3H35T (function() { // Generate the test array with random strings let arr = []; for (let i = 0; i < 100000; i++) { arr[i] = Math.random().toString(36).substring(2, 3 + Math.floor(Math.random() * 9)); } Array.prototype.loop = function(func) { let l = this.length; for (let i = 0; i < l; i++) { func(this[i]); } } const add = (x)=>o += x; let o = ''; var loop; console.time(loop = 'Loop - for -') for (let i of arr) { add(i); } console.timeEnd(loop); o = ''; console.time(loop = 'Loop - prototype -') arr.loop(add); console.timeEnd(loop); // console.log(o) console.log('Array length', arr.length); } )(); One browser is faster at one and the other the other...hehe, this is the point where people tell you that micro benchimarking is a fools game and most of the time its just best to write code thats easiest to read, debug, test, blah, blah. And most of the time they're right.
  6. PAEz

    javascript indexOf()

    If your using a modern browser you could also have used 'includes'.... if(mois[i].includes('r')) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
  7. PAEz

    HTML: Dynamic calculations on the page

    Just make sure that the constant x is declared in a function (the one that does the calc) and isnt defined as a global variable (scope kept to the function) so that they cant change its value from the console.
×