InstagramPharo/Instagram/InstagramDownloader.class.st

57 lines
1.4 KiB
Smalltalk
Raw Normal View History

Class {
#name : #InstagramDownloader,
#superclass : #Object,
#instVars : [
'bin',
'profiles'
],
#category : #Instagram
}
{ #category : #'as yet unclassified' }
InstagramDownloader >> downloadProfile: anInstProfileName [
| profiles |
profiles := (FileLocator documents / 'InstagramDownloader' / 'Profiles') ensureCreateDirectory.
^ GtSubprocessWithInMemoryOutput new
workingDirectory: profiles;
command: bin fullName;
arguments: {anInstProfileName.
'--no-videos'.
'--no-compress-json'};
runAndWait;
stdout
]
{ #category : #'as yet unclassified' }
InstagramDownloader >> initialize [
super initialize.
]
{ #category : #'as yet unclassified' }
InstagramDownloader >> installDefault [
| py doc location |
doc := FileLocator documents.
location := (doc / 'InstagramDownloader') ensureCreateDirectory.
py := PyEnv new.
py createEnv: 'InstagramDownloader' in: doc.
py install: 'instaloader' in: 'InstagramDownloader'.
bin := location / 'bin' / 'instaloader'.
]
{ #category : #accessing }
InstagramDownloader >> loadDefault [
| temp |
temp := FileLocator documents / 'InstagramDownloader'.
bin := temp / 'bin' / 'instaloader'.
profiles := temp / 'Profiles'
]
{ #category : #'as yet unclassified' }
InstagramDownloader >> profiles [
| location |
profiles
ifNil: [ location := bin parent parent / 'Profiles'.
location exists ifFalse: [ ^ profiles := location ensureCreateDirectory ] ].
^ profiles
]