DEV Community

Cover image for How to make up to $600 writing an article -- from zero to genius.

How to make up to $600 writing an article -- from zero to genius.

Ayobami Ogundiran on November 09, 2021

Have you ever dreamed of making money writing technical articles? How would you feel if I were to tell you that certain publications will pay you u...
Collapse
 
medosa profile image
Mark Edosa • Edited

DOWNLOAD Company name, pricing, and links as a CSV.

Great post bro! I like how you were very consistent in this post making it easy to parse and extract the content with code.

You can organize the companies, pricing, and links in a spreadsheet to keep track of your applications. Here's a code to download the content as a CSV file.

// This function was taken from https://stackoverflow.com/questions/21012580/is-it-possible-to-write-data-to-file-using-only-javascript
// very lazy me :)
var textFile = null,
  makeTextFile = function (text) {
    var data = new Blob([text], {type: 'text/plain'});

    // If we are replacing a previously generated file we need to
    // manually revoke the object URL to avoid memory leaks.
    if (textFile !== null) {
      window.URL.revokeObjectURL(textFile);
    }

    textFile = window.URL.createObjectURL(data);

    // returns a URL you can use as a href
    return textFile;
  };

function download(content) {
    var link = document.createElement('a');
    link.setAttribute('download', 'file.csv');
    link.href = makeTextFile(content);
    link.click();
}

// initialize csv with heading
let csv = 'Company,Price,Link\n';

// Get all paragraphs after an h3 heading 
let pgs = document.querySelectorAll('h3 + p');

// extract link, company and pricing
function extractDetails(p) {
    let link = p.querySelector('a')?.href;
    let content = p.textContent;
    let company = content.substring(0, content.indexOf('pays')).trim();
    let price = content.split(' ').find(c => c.startsWith('$'));

   // link could be absent sometimes
    if (company && price) {
        return `${company},up to ${price},${link ?? ''}\n`;
    }
    return ''
}

// build csv
pgs.forEach(p => {
    const details = extractDetails(p);
    csv += details;
});

// console.log(csv);
download(csv);
Enter fullscreen mode Exit fullscreen mode

While on this page

  • open your browser dev tools
  • go to sources or anywhere you can paste and run the code
  • well, run it :)

Open the downloaded file.csv in a spreadsheet and add other columns to keep track of your applications.

No need for fun, just give me the CSV file.

I hope this helps.

Collapse
 
packetsdk profile image
PacketSDK

Hi,We are PacketSDK for app developers earning passive income. Users can earn money by integrating our SDK into their apps.We are very interested in the technical articles you published. We would like to ask you to write promotional articles about our products. Are you interested in cooperating with us?
If you are interested, please contact our email:packetsdkcom@gmail.com

Collapse
 
rammina profile image
Rammina

This was definitely informative! Thank you!

Collapse
 
codingnninja profile image
Ayobami Ogundiran

You're welcome...

Collapse
 
liandro-silva profile image
Liandro Silva

Great post! Tks

Collapse
 
codingnninja profile image
Ayobami Ogundiran

Thanks for reaching out...I am glad you like it.

Collapse
 
thebuildguy profile image
Tulsi Prasad

Awesome insights, learnt something new!

Collapse
 
yamanidev profile image
Mohamed Yamani

You really do like the number 6 don't you lol.

Rich post. Thanks!

Collapse
 
codingnninja profile image
Ayobami Ogundiran

Yeah! Thanks for the awesome comment.

Collapse
 
sevolil6 profile image
sevolil6

Thank you for such wise things. Indeed, when I first started working with writing, I did not know how to make money on my professionalism and then I wrote my thesis and someone bought them, for me it was a shock. Now I write at papersowl.com/write-my-thesis and I am sure that such skills for a professional will always be valued especially in the eophoh of high technology.

Collapse
 
joelezema profile image
Joel Ezema

Damn, I'm five years late