This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
1. go to https://www.amazon.com/ | |
2. search "programing books" | |
3. open the browser javascript console | |
*/ | |
// Get the list of elements of the parent element. It returns a NodeList and we convert it into an array to be able to traverse it. | |
const elementList = Array.from(document.querySelectorAll('[data-component-type="s-search-result"]')); | |
// Initialize an array to store the names of the books |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import libraries | |
const puppeteer = require("puppeteer"); | |
const urlencode = require("urlencode"); | |
// define vriables | |
let search = 'The Doors'; | |
const SP_BASE_URL = "https://open.spotify.com"; | |
const SP_SEARCH_URL = SP_BASE_URL + "/search/" + urlencode(search); | |
const YT_BASE_URL = "https://www.youtube.com"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// go to the playlists section | |
const [linkPlaylist] = await page.$x("//a[contains(text(), 'Playlist')]"); | |
await linkPlaylist.click(); | |
await page.waitForNavigation(); | |
// get all playlists found | |
const listPlaylists = await page.evaluate(() => { | |
let list = []; | |
let playlists = Array.from( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const listTracks = await page.evaluate(() => { | |
let list = []; | |
let tracks = Array.from( | |
document.querySelectorAll('div[data-testid="tracklist-row"]') | |
); | |
tracks.map((track) => { | |
let divTrack = track.querySelectorAll("div")[2]; | |
let trackData = divTrack.querySelector( | |
"div > div .da0bc4060bb1bdb4abb8e402916af32e-scss" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// go to youtube | |
await page.goto(YT_BASE_URL, { waitUntil: "networkidle2" }); | |
// search and add track to playlist | |
for (const listTrack of listTracks) { | |
// text to search | |
let track = `${listTrack.artist} live ${listTrack.song}`; | |
// wait for the input and clean it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* First step, find the people you want to follow | |
* Second step, run the following script in the page inspector console | |
*/ | |
// get all profiles displayed | |
const allprofiles = Array.from(document.querySelectorAll('.js-followButton')); | |
// return all profiles no following yet | |
const newprofiles = allprofiles.filter((profile) => { | |
return !profile.classList.contains('is-active') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Steps | |
* 1. Search a hastag | |
* 2. Click on a post | |
* 3. Open browser console | |
* 4. Copy and paste sleep function, press enter | |
* 5. Copy and paste main function, press enter | |
*/ | |
(async function funfollower() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect } from 'react' | |
import styled from 'styled-components' | |
import Slider from 'react-slick' | |
import thumbnail from '../assets/img/img1.jpg' | |
import '../styles/instagram.min.css' | |
import 'slick-carousel/slick/slick.css' | |
import 'slick-carousel/slick/slick-theme.css' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react' | |
import Slider, { SliderTooltip } from 'rc-slider' | |
import styled from 'styled-components' | |
import 'rc-slider/assets/index.css' | |
const CustomFilterOptionsStyles = styled.div` | |
.customFilters-container { | |
width: 400px; | |
margin-right: 100px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const responseTime = require('response-time') | |
const redis = require('redis') | |
const axios = require('axios') | |
const runApp = async () => { | |
// connect to redis | |
const client = redis.createClient() | |
client.on('error', (err) => console.log('Redis Client Error', err)); |
OlderNewer