Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tweespaces

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tweespaces - npm Package Compare versions

Comparing version 0.0.28 to 0.0.29

utils/find-space-by-host.js

9

index.js

@@ -14,2 +14,3 @@ #!/usr/bin/env node

const findSpace = require('./utils/find-space');
const findSpaceByHost = require('./utils/find-space-by-host');

@@ -24,6 +25,10 @@ const input = cli.input;

if (flags.username) {
await findSpaceByHost({ username: flags.username })
}
if (flags.live) {
await findSpace({scheduled: false, live: true, query: flags.query});
await findSpace({ scheduled: false, live: true, query: flags.query });
} else if (flags.scheduled) {
await findSpace({scheduled: true, live: false, query: flags.query});
await findSpace({ scheduled: true, live: false, query: flags.query });
}

@@ -30,0 +35,0 @@

{
"name": "tweespaces",
"description": "Lookup Twitter spaces by keyword",
"version": "0.0.28",
"version": "0.0.29",
"license": "MIT",

@@ -42,3 +42,2 @@ "bin": {

"cli-welcome": "^2.2.2",
"dotenv": "^10.0.0",
"lodash.merge": "^4.6.2",

@@ -45,0 +44,0 @@ "meow": "^9.0.0",

@@ -40,2 +40,6 @@ const meow = require('meow');

desc: `Search query`
},
host: {
type: `string`,
desc: `The host of the space`
}

@@ -45,3 +49,3 @@ };

const commands = {
help: { desc: `Print help info` },
help: { desc: `Print help info` }
};

@@ -48,0 +52,0 @@

@@ -1,19 +0,16 @@

require('dotenv').config();
const { dim, italic, bold, red, green } = require('chalk');
const Spinner = require('cli-spinner').Spinner;
const merge = require('lodash.merge');
const emoji = require('node-emoji')
const axios = require('axios')
const emoji = require('node-emoji');
const axios = require('axios');
module.exports = async ({
scheduled,
live,
query
}) => {
module.exports = async ({ scheduled, live, query, username }) => {
const state = scheduled ? 'scheduled' : live ? 'live' : 'live';
const state = scheduled ? 'scheduled' : live ? 'live' : 'live'
const response = await axios.post(`https://tweespaces-serverless-function.vercel.app/api/spaces`,
const spaceResponse = await axios.post(
`https://tweespaces-serverless-function.vercel.app/api/spaces`,
{
state,
query
query,
username
},

@@ -23,8 +20,9 @@ {

'Content-Type': 'application/json'
},
});
}
}
);
const data = response.data.spaces.data;
const meta = response.data.spaces.meta;
const includes = response.data.spaces.includes;
const data = spaceResponse.data.spaces.data;
const meta = spaceResponse.data.spaces.meta;
const includes = spaceResponse.data.spaces.includes;

@@ -41,61 +39,90 @@ const spinner = new Spinner(dim('Searching for spaces.....'));

if (query !== undefined && scheduled) {
return console.log(emoji.get('scream'), ' ', bold('No results found! Try a different query or search for live spaces...'))
return console.log(
emoji.get('scream'),
' ',
bold(
'No results found! Try a different query or search for live spaces...'
)
);
} else if (query !== undefined && live) {
return console.log(emoji.get('scream'), ' ', bold('No results found! Try a different query or search for scheduled spaces...'))
return console.log(
emoji.get('scream'),
' ',
bold(
'No results found! Try a different query or search for scheduled spaces...'
)
);
} else if (query === undefined) {
return console.log(emoji.get('scream'), ' ', bold('No results found! Try adding a query...'))
return console.log(
emoji.get('scream'),
' ',
bold('No results found! Try adding a query...')
);
}
return console.log(emoji.get('scream'), ' ', bold('No results found!'))
return console.log(emoji.get('scream'), ' ', bold('No results found!'));
}
const spaceInfo = data.map(({
participant_count,
scheduled_start,
title,
creator_id
}) => {
return {
creator_id,
participants: participant_count,
start: scheduled_start,
title,
};
})
const spaceInfo = data.map(
({ participant_count, scheduled_start, title, creator_id }) => {
return {
creator_id,
participants: participant_count,
start: scheduled_start,
title
};
}
);
const creatorInfo = includes.users.map(({
name,
username,
description,
id
}) => {
return {
id,
creatorHandle: username,
creator: name,
description
};
})
const creatorInfo = includes.users.map(
({ name, username, description, id }) => {
return {
id,
creatorHandle: username,
creator: name,
description
};
}
);
const space = merge(spaceInfo, creatorInfo)
const space = merge(spaceInfo, creatorInfo);
function twitterHandleLink(handle) {
return `https://twitter.com/${handle}`
return `https://twitter.com/${handle}`;
}
space.map(({ title, creator, creatorHandle, start, description }) => {
const timingCheck = () => {
if (start === undefined) {
return console.log(emoji.get('timer_clock'), ' ', bold('Live now!'))
return console.log(
emoji.get('timer_clock'),
' ',
bold('Live now!')
);
}
return console.log(emoji.get('timer_clock'), ' ', bold('Time: ', new Date(start).toLocaleTimeString('en-US')), dim(italic(' (All times localized)')), emoji.get('sunglasses'))
}
return console.log(
emoji.get('timer_clock'),
' ',
bold('Time: ', new Date(start).toLocaleTimeString('en-US')),
dim(italic(' (All times localized)')),
emoji.get('sunglasses')
);
};
const dateCheck = () => {
if (start === undefined) {
return null
return null;
}
return console.log(emoji.get('calendar'), ' ', bold('Date: ', new Date(start).toLocaleDateString('en-US')))
}
return console.log(
emoji.get('calendar'),
' ',
bold('Date: ', new Date(start).toLocaleDateString('en-US'))
);
};
console.log(red(bold('-----------------------------------------------------------------------------')));
console.log(
red(
bold(
'-----------------------------------------------------------------------------'
)
)
);
console.log(red(bold('Space details')));

@@ -105,16 +132,31 @@ console.log();

console.log();
dateCheck()
dateCheck();
console.log();
timingCheck()
console.log(green(bold('-----------------------------------------------------------------------------')));
timingCheck();
console.log(
green(
bold(
'-----------------------------------------------------------------------------'
)
)
);
console.log(green(bold('Host details')));
console.log();
console.log(emoji.get('writing_hand'), ' ', bold('Name: ', creator))
console.log(emoji.get('writing_hand'), ' ', bold('Name: ', creator));
console.log();
console.log(emoji.get('question'), ' ', bold('Bio: ', description))
console.log()
console.log(emoji.get('baby_chick'), ' ', bold('Handle: ', twitterHandleLink(creatorHandle)))
console.log(green(bold('-----------------------------------------------------------------------------')));
console.log(emoji.get('question'), ' ', bold('Bio: ', description));
console.log();
console.log(
emoji.get('baby_chick'),
' ',
bold('Handle: ', twitterHandleLink(creatorHandle))
);
console.log(
green(
bold(
'-----------------------------------------------------------------------------'
)
)
);
});
}
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc