Add 'partners' dataset

This commit is contained in:
tree 2022-01-09 12:36:25 +01:00
rodič 7be644b9e7
revize 2be3fbb0a1
7 změnil soubory, kde provedl 65 přidání a 1 odebrání

Zobrazit soubor

@ -40,6 +40,7 @@ Veřejný HTTP endpoint s datovými soubory ve formátu JSON naleznete na adrese
| **tracks** | Programové sekce | [https://spec.utxo.cz/22/tracks.json](https://spec.utxo.cz/22/tracks.json) |
| **events** | Události | [https://spec.utxo.cz/22/events.json](https://spec.utxo.cz/22/events.json) |
| **faqs** | Často kladené dotazy (FAQ) | [https://spec.utxo.cz/22/faqs.json](https://spec.utxo.cz/22/faqs.json) |
| **partners** | Partneři (sponzoři, mediální partneři atp.) | [https://spec.utxo.cz/22/partners.json](https://spec.utxo.cz/22/partners.json) |
| **bundle** | Vše v jednom souboru | [https://spec.utxo.cz/22/bundle.json](https://spec.utxo.cz/22/bundle.json) |
## Detaily k jednotlivým ročníkům

Zobrazit soubor

@ -17,3 +17,4 @@ specDef:
- type: tracks
- type: events
- type: faqs
- type: partners

10
spec/22/partners.yaml Normal file
Zobrazit soubor

@ -0,0 +1,10 @@
- id: mitonc
name: MitonC
type: sponsor
twitter: mitoncfund
- id: polkadotters-czsk
name: Polkadotter CZ/SK
type: community
twitter: PolkadottersS

Binární soubor nebyl zobrazen.

Za

Šířka:  |  Výška:  |  Velikost: 12 KiB

Binární soubor nebyl zobrazen.

Za

Šířka:  |  Výška:  |  Velikost: 18 KiB

Zobrazit soubor

@ -0,0 +1,24 @@
type: array
items:
type: object
additionalProperties: false
required:
- id
- name
- type
properties:
id:
type: string
pattern: '^[a-z0-9-]+$'
name:
type: string
type:
type: string
enum:
- sponsor
- community
- medium
twitter:
type: string
pattern: '^[a-zA-Z0-9_]+$'

Zobrazit soubor

@ -11,6 +11,7 @@ await utxo.init()
config({ path: ".env", export: true })
const twitterImagesPath = './spec/22/photos/speakers/'
const twitterPartnersImagesPath = './spec/22/photos/partners/'
const simple_twitter = new SimpleTwitter({
consumer_key: Deno.env.get("CONSUMER_KEY"),
@ -26,6 +27,33 @@ const entry = utxo.entries[entryId]
const arr = []
let total = 0
// partners
for (const sp of entry.specs.partners) {
if (!sp.twitter) {
continue
}
const tw = await twitterUser(sp.twitter)
if (!tw) {
continue
}
const imageFn = twitterPartnersImagesPath + sp.id + '-twitter.jpg'
if (!await exists(imageFn)) {
const url = tw.profile_image_url_https.replace('_normal', '')
console.log(url)
const res = await fetch(url)
const file = await Deno.open(imageFn, { create: true, write: true })
const reader = fromStreamReader(res.body.getReader())
await Deno.copy(reader, file)
file.close()
}
arr.push([ `partner:${sp.type}`, tw.screen_name, tw.followers_count ])
total += tw.followers_count
}
// speakers
for (const sp of entry.specs.speakers) {
if (!sp.twitter) {
continue
@ -46,7 +74,7 @@ for (const sp of entry.specs.speakers) {
file.close()
}
arr.push([ tw.screen_name, tw.followers_count ])
arr.push([ 'speaker', tw.screen_name, tw.followers_count ])
total += tw.followers_count
}