2024-09-15 23:08:28 +00:00
|
|
|
Class {
|
|
|
|
#name : #InstagramDownloader,
|
|
|
|
#superclass : #Object,
|
2024-09-15 23:51:49 +00:00
|
|
|
#instVars : [
|
|
|
|
'bin',
|
|
|
|
'profiles'
|
|
|
|
],
|
2024-09-15 23:08:28 +00:00
|
|
|
#category : #Instagram
|
|
|
|
}
|
|
|
|
|
2024-09-15 23:51:49 +00:00
|
|
|
{ #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
|
|
|
|
]
|
|
|
|
|
2024-09-15 23:08:28 +00:00
|
|
|
{ #category : #'as yet unclassified' }
|
|
|
|
InstagramDownloader >> initialize [
|
|
|
|
super initialize.
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
|
|
InstagramDownloader >> installDefault [
|
2024-09-15 23:51:49 +00:00
|
|
|
| py doc location |
|
|
|
|
doc := FileLocator documents.
|
|
|
|
location := (doc / 'InstagramDownloader') ensureCreateDirectory.
|
2024-09-15 23:08:28 +00:00
|
|
|
py := PyEnv new.
|
2024-09-15 23:51:49 +00:00
|
|
|
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
|
2024-09-15 23:08:28 +00:00
|
|
|
]
|