The chances of getting any flavor should be the same

This commit is contained in:
bingus_violet 2024-12-24 03:52:44 -06:00
parent 6dc65275a2
commit 23c07b1146
3 changed files with 15 additions and 12 deletions

View file

@ -1,8 +1,8 @@
import * as path from "path"
import { fileURLToPath } from "url"
export const flavors = ["#reflectivedetective", "#alearfred", "リュアル"]
export const variety = 200
export const flavors = [["#reflectivedetective"], ["#alearfred", "リュアル"]]
export const variety = 5
export const PORT = process.env.PORT || 8080
export const __dirname = path.dirname(fileURLToPath(import.meta.url))
export const staticPath = path.join(__dirname, "static")

View file

@ -8,15 +8,17 @@ await scraper.login(process.env.USERNAME, process.env.PASSWORD)
export async function scrapeYaoi() {
var finalArray = []
for (let flavor of flavors) {
console.log(flavor)
var search = scraper.searchTweets(flavor, variety, "media")
for await (var value of search) {
// console.log(finalArray.includes(value))
if (value.html.includes("img") & !finalArray.includes(value)) {
// console.log(value)
finalArray.push(value)
for (let typeIndex in flavors) {
let types = flavors[typeIndex]
finalArray[typeIndex] = []
for (let flavor of types) {
// console.log(flavor)
var search = scraper.searchTweets(flavor, variety, "media")
for await (var value of search) {
if (value.html.includes("img") & !finalArray.includes(value)) {
finalArray[typeIndex].push(value)
}
}
}
}
@ -26,6 +28,7 @@ export async function scrapeYaoi() {
export var yaoiList = await scrapeYaoi()
export function getYaoi() {
var yaoi = yaoiList[Math.floor(Math.random() * yaoiList.length)]
yaoi = yaoi[Math.floor(Math.random() * yaoi.length)]
return yaoi
}

View file

@ -74,7 +74,7 @@ a {
font-weight: bold;
background-clip: text;
-webkit-text-fill-color: transparent;
color: transparent;
transition: transform 2s cubic-bezier(0.075, 0.82, 0.165, 1);
}