I found somethings like this code to send to Telegram-CLI but I have no idea what it means or how to do it so if someone could explain it to me step by step I'd be so happy.
https://github.com/psamim/telegram-cli-backup
I couldn't install sqlite3 for some reason with the given code there.
I'm using windows, do I need to boot into Ubuntu to do it?
Anyways, explain it to me like I'm 3 years old in case I won't know something.
Thanks so much.
If you are using windows check the instructions here. I've only tried in Linux and the link in your question (using Lua) works.
The following scripts too does the job well
Python script to backup everything
https://github.com/tvdstaaij/telegram-json-backup
Here is a ruby version of the same https://github.com/tvdstaaij/telegram-history-dump
The mentioned script is updated and now it saves the conversations into a CSV file and does not need sqlite3 library any more. It only needs lua.
It seems I could help you a little.
I am using Ubuntu and I wrote this Bash-script:
#!/bin/bash
TOKEN='YourBot:Token'
URL='https://api.telegram.org/bot'$TOKEN
UPD_URL=$URL'/getUpdates?offset='
function get_offset {
res=$(curl $UPD_URL$OFFSET)
OFFSET=$(echo $res | grep "update_id" | cut -f 4 -d ':' | cut -f 1 -d ',' | head -1)
OFFSET=$((OFFSET+1))
}
while :
do
get_offset
if echo $res | grep "message"
then echo $res >> BackupChat.txt
fi
done
It is very simple bash-script.
Obviously you must create your own bot and add bot to the chat you want to backup.
Bad things about this script is that it creates pretty difficult for reading text logfile with mass garbage like "username" "date" "::" , etc. But it could be improved for making a normal output looking like a cool database.
I hope you have enough Linux skills to make it by yourself.
I think the situation improved since this question was asked, so here an answer from a 2020's point of view that does not require any programming skills or command line tools.
To backup (aka. "export") your Telegram chats download the desktop client available here:
https://desktop.telegram.org/
On Linux, for example, unpack the downloaded file into any subdirectory like ~/tmp/, and start the client from there, like
$ cd ~/tmp/Telegram
$ ./Telegram
You will need to register first with your phone number like on any other Telegram devices via a confirmation code sent to your already logged-in telegram account.
The user interface looks similar to the web interface.
Go into a chat you are interested in, then in the upper right menu choose "Export chat history". Click all checkboxes you are interested in, like media files, GIFs, stickers, etc. and click export.
By default it generates a complete HTML files and subdirectory structure under ~/Downloads/Telegram Desktop/ which you can open for instance like this:
firefox ~/Downloads/Telegram\ Desktop/ChatExport_01_02_2020/messages.html
If you need a more complete backup of all chats you can go to the central menu (3 small bars) on the top left, then "Settings" -> "Advanced" -> under "Data and Storage" choose "Export Telegram data". There you can also click checkboxes for what you are interested in. Near the bottom is aselection between HTML for humas, or machine-readable JSON.
On the very first export request it first requires you to confirm on another Telegram instance to allow the export request, to avoid misuse. Once you confirmed, e.g. from your mobile phone, you can go to export again and proceed as described above without any further confirmations.
Related
I'm trying to automaticly upload video's to youtube on mine synology NAS (DS220+)
I've found this link to tokland youtube-upload.
All the steps on this github page I've done correctly (i think but obvious not :)
I think there is a auth problem whit Google and I'm not sure what I'm doing wrong or maybe there is a better way.
Steps I've taken:
-via SSH installed google-api-python-client and ofcourse youtube-upload-master.
-created a chanal and API credentials at youtube for clientsecrets.json
(Here I think I'm going wrong --> not shut what to put in the "Authorized redirect URIs" a.k.a. redirect_uris)
below you found mine client_secrets.json (ofcourse whitout the real client/project id's) but the redirect_uris and javascript_origins is legit (i think but posibly also the problem but realy don't know how to handle this)
{
"web":{
"client_id":"client-id",
"project_id":"project-id",
"auth_uri":"https://accounts.google.com/o/oauth2/auth",
"token_uri":"https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs",
"client_secret":"client-secret",
"redirect_uris":["http://localhost"],
"javascript_origins":["http://localhost"]
}
}
In the end I was hoping ( and maybe not even posible but I'm new at this and needed a goal in this corona time) making a simple batch script to call this script when a file apears in a folder and upload it to a chanel in youtube.
batch script:
youtube-upload \
--title="test title" \
--description="test description" \
--category="Music" \
--tags="mutter, beethoven" \
--recording-date="2011-03-10T15:32:17.0Z" \
--default-language="en" \
--default-audio-language="en" \
--client-secrets="/volume1/some/folder/client_secrets.json" \
test.mp4
When I run the above code via SSH on the synology I'm getting a question to enter a verification code.
whish i must get from the link above the question to "read in" the access token ( I think , again I'm new and trying to understand this langues)
When I follow the link I'm getting this site from google instead a code :
I'm realy stuck at this moment and open for some new insight.
All I want to do is upload a video to youtube in a scheduled automatic way from a synology NAS.
Doesn't sound very complicated when i started but couldn't find any good exmples to build on.
Does anybody know what I'm doing wrong or does a better way to do this?
EDIT (for future reference) :
Afther some playing around and help from #stvar I installed a new secrets file:
{
"installed":{
"client_id":"someclientid",
"project_id":"somecprjid",
"auth_uri":"https://accounts.google.com/o/oauth2/auth",
"token_uri":"https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs",
"client_secret":"somesecret",
"redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]
}
}
??? Afther this i got another error whish i thought i was creating ???? :
IOError: [Errno 2] No such file or directory: '/var/services/homes/usrname/.youtube-upload-credentials.json'
give it a shot ytb_up based selenium all you need is login into your google account and get a cookie json
https://github.com/wanghaisheng/ytb-up
features YOU MAY NEED
proxy support
auto detect whether need a proxy
2. cookie support
for those multiple channels under same google account
3. schedule time publish
you can explictly specify a date and time for each video or you can set publish policy and daily public count,for example,daily count is 4,you got 5 videos,then first 4 will be published 1 day after the upload date ,the other 1 will be 2 days after the upload date
4. fix google account verify
How can you instruct an application or the printer to only print the first page, a page range or just odd or even pages of a file? I attempt this with the help of the Preview app, which looks promising:
set theFile to "[file-path/file]""
tell application "Preview"
activate
print theFile with properties {target printer:"Printer", ending page:1} without «class pdlg»
--these properties isn't available for the printer app, here just limiting amount of printed pages
quit
end tell
But with this I'm bitten by the sandboxd process that tells me the file can't be opened for printing and I get a deny file-read-data result in the log.
In the CUPS suggestion by adamh I encounter issues with umlauts and have other execution issues as well, possibly also because of sandbox rules. The code works from the command line, but not when called in automated fashion.
I tried to look up useful examples of the print command in a reference, in my books and tried searching the online Apple references, but I can't seem to find many examples fitting to the present day situation with sandbox, if any.
You could script printing by command line tool lp & lpr.
These talk to CUPS, Common Unix Printing System
To target pages / ranges:
lp -o page-ranges=2-4 "my_great_document.pdf"
To call it from applescript use do shell script
e.g,
do shell script "lp -o page-ranges=2-4 'my_great_document.pdf'"
For more ideas see: http://www.cups.org/documentation.php/options.html
Im doing a little research into installers, and right now at my company we are having some issues deploying from jenkins using click once. We have a test certificate(these programs are all internal) and for some reason are having some issues with the certifcate being incompatiable with certain msbuilds/.net frameworks. So im looking into alternatives.
But in that i want to keep the same architecture. How it works right now is someone clicks on a button in our task bar, clicks on the application they want, and then click once installs the updates(or installs) without further user input and starts the application. Ive heard a lot of good things about NSIS.
So far ive only seen generic application installers like you expect when you download anything from the internet. Could I do something like i described above using NSIS?
A very basic no interaction installer might look like this:
Name foo
OutFile foo_setup.exe
AutoCloseWindow true
RequestExecutionLevel user
InstallDir "$LocalAppData\Programs\MyApp"
Page InstFiles
Section
SetOutPath "$InstDir"
WriteUninstaller "$InstDir\uninst.exe"
; TODO: Add registry entry for Add/Remove Programs
File "MyApp.exe"
File "Data.xml" ; Support files etc
Exec '"$InstDir\MyApp.exe" -firstrun "c:\some path\file.ext"'
SectionEnd
Section Uninstall
Delete "$InstDir\MyApp.exe"
Delete "$InstDir\Data.xml"
Delete "$InstDir\uninst.exe"
RMDir "$InstDir"
SectionEnd
If you want to install for all users in %ProgramFiles% you can run into issues with Exec because the app can end up running as the wrong user if a non-administrator used some other account in the UAC dialog.
We have an internal and external facing asp.net mvc app running under mono on ubuntu 10.04 LTS. There is also a complicated (native, not mono) command line app that users use on the same server. They log on via ssh to do this. We have the security for the ssh users pretty locked down, so they can't do very much other than run the command line app.
The users of these apps have to:
login via ssh to the server, run the command line app with whatever command line switches are required which then does some long running processing and puts a report in the db of the web app.
Login to the web app, then set some options for publishing a report via the web app.
The users of the apps want to skip step 1 and do it all in the web app. I am thinking of creating a service that regulary polls the db for command line app jobs to run. The jobs would be created by the users as desired in the web app.
The problem is, the users want a box in the web app where they can just fill in any command line options. But I don't want them to do something like this:
-a dothis -b dothis & rm importantfile.txt
...in case the user's credentials to the web app are somehow compromised. I want to make sure that only that command line app can be used and nothing else. I am thinking of preventing the characters ! | < > & / \ $ ( ) from being allowed, which looks like are not required by the command line app.
Is that good enough? Are there any other shell tricks I should know about? Should I take a different approach?
I really don't want to have to write some sort of parser for the arguments that the users supply, because there are a ton of them that the users like to use.
Instead of running the command line as a shell command (launching the shell to launch the program), can you launch the program itself as a new process? I believe that's what the answer here is doing: Execute a command line utility in ASP.NET . If the actual program is launched as a process, rather than a shell, then things like & or rm will just be arguments to the command line utility, which should be fine if the command line utility checks for bad inputs.
If that's not feasible (although it's probably the better option), replacing all single quotes with single quote escape sequences, then placing single quotes around each of the arguments (split the string with a space as the delimeter), could provide a similar effect. Instead of making sure you avoid all possible bad characters (; can be used similarly to & in many shells), you only need to make sure that the provided arguments can't escape out of the single quotes. (You might also want to check for single quote surrounded arguments beforehand, to avoid double quoting them, and don't cound escaped spaces when splitting up arguments, etc., so that the users can provide arguments that need spaces).
I am able to get a shell registry type context menu function to work , see below . But is there a way to tell windows to send multiple files selected to the same application , perhaps instead of %1 or %L some other parameter . What happens now is that it launches the associated application for each file in the list .
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT*\shell]
[HKEY_CLASSES_ROOT*\shell\sendtomyapp]
#="&Upload to (File*Pics)Mojo"
[HKEY_CLASSES_ROOT*\shell\sendtomyapp\command]
#="c:\Program Files\app_directory\App.exe -n \"%1\""
Is there a way to send an array of names like sys.args in python ?
My guess is to look into DDEExec instead of shell\open\command. http://msdn.microsoft.com/en-us/library/bb165967(VS.80).aspx
Seems like a superuser.com question, but I think these kind of operations require a bit of code. e.g. you write a proxy program that accepts the files, and adds them to an execution queue or batch of another program (like adding several files to a media player) I don't know if what you are looking for is supported inherently in Windows
You will need a full shell extension DLL to do what you want to do here. So the answer is programming even if the question was not.